Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/functions/prelude_enumerable/hash.rb
Instance Method Summary collapse
Instance Method Details
#map_hash ⇒ Object
11 12 13 |
# File 'lib/functions/prelude_enumerable/hash.rb', line 11 def map_hash Hash[self.map{|k, v| [k, yield(v)] }] end |
#zip_hash_inner(bs) ⇒ Object
7 8 9 |
# File 'lib/functions/prelude_enumerable/hash.rb', line 7 def zip_hash_inner(bs) self.each_with_object({}) { |(k, a), h| b = bs[k]; h[k] = [a, b] if b; h } end |
#zip_hash_left(bs) ⇒ Object
3 4 5 |
# File 'lib/functions/prelude_enumerable/hash.rb', line 3 def zip_hash_left(bs) self.each_with_object({}) { |(k, a), h| h[k] = [a, bs[k]]; h } end |