Sha256: 5a194293ba3c845550c85aee72abf85f091940176a4ac8f08218fcd04bef2b24

Contents?: true

Size: 123 Bytes

Versions: 5

Compression:

Stored size: 123 Bytes

Contents

class Hash
  def map_keys(key_hash)
    inject({}) do |h, (k, v)|
      h.merge((key_hash[k] || k) => v)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
freighthopper-0.1.14 lib/freighthopper/hash/map_keys.rb
freighthopper-0.1.13 lib/freighthopper/hash/map_keys.rb
freighthopper-0.1.12 lib/freighthopper/hash/map_keys.rb
freighthopper-0.1.11 lib/freighthopper/hash/map_keys.rb
freighthopper-0.1.9 lib/freighthopper/hash/map_keys.rb