# File lib/fluent/plugin/filter_record_transformer.rb, line 208 def expand(str) interpolated = str.gsub(/\$\{([^}]+)\}/, '#{\1}') # ${..} => #{..} eval "\"#{interpolated}\"", @placeholders.instance_eval { binding } rescue => e log.warn "failed to expand `#{str}`", :error_class => e.class, :error => e.message log.warn_backtrace nil end
Get placeholders as a struct
@param [Time] time the time @param [Hash] record the record @param [Hash] opts others
# File lib/fluent/plugin/filter_record_transformer.rb, line 201 def prepare_placeholders(time, record, opts) struct = UndefOpenStruct.new(record) struct.time = Time.at(time) opts.each {|key, value| struct.__send__("#{key}=", value) } @placeholders = struct end
Generated with the Darkfish Rdoc Generator 2.