Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#flatten_hash(hash) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fluent/plugin/out_indicative.rb', line 8

def flatten_hash(hash)
  hash.each_with_object({}) do |(k, v), h|
    if v.is_a? Hash
      flatten_hash(v).map do |h_k, h_v|
        h["#{k}.#{h_k}"] = h_v
      end
    else 
      h[k] = v
    end
   end
end