Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/core_ext/hash.rb
Instance Method Summary collapse
Instance Method Details
#hmap(&block) ⇒ Object
4 5 6 |
# File 'lib/core_ext/hash.rb', line 4 def hmap(&block) reduce({}) { |hash, (k, v)| hash.merge(block.call(k, v)) } end |
#hmap!(&block) ⇒ Object
8 9 10 |
# File 'lib/core_ext/hash.rb', line 8 def hmap!(&block) replace hmap(&block) end |