Module: Fluent::FlattenHashUtil
- Included in:
- FlattenHashFilter, FlattenHashOutput
- Defined in:
- lib/fluent/plugin/flatten_hash_util.rb
Instance Method Summary collapse
Instance Method Details
#flatten_record(record, prefix) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/fluent/plugin/flatten_hash_util.rb', line 3 def flatten_record(record, prefix) ret = {} if record.is_a? Hash record.each { |key, value| ret.merge! flatten_record(value, prefix + [key.to_s]) } elsif record.is_a? Array and @flatten_array record.each_with_index { |elem, index| ret.merge! flatten_record(elem, prefix + [index.to_s]) } else return {prefix.join(@separator).gsub(@remove_tag_prefix, "") => record} end ret end |