Sha256: 68945c12f71da42d5d624f8c15f4988e296cbe3a91c66bb80cf9329118f7de9f

Contents?: true

Size: 314 Bytes

Versions: 3

Compression:

Stored size: 314 Bytes

Contents

module Chronicle::Utils
  module Hash
    def self.flatten_keys(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}".to_sym] = h_v
          end
        else 
          h[k] = v
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chronicle-core-0.2.1 lib/chronicle/utils/hash.rb
chronicle-core-0.2.0 lib/chronicle/utils/hash.rb
chronicle-core-0.1.0 lib/chronicle/utils/hash.rb