Class: Remap::Iteration::Hash
- Inherits:
-
Concrete
- Object
- Concrete
- Remap::Iteration::Hash
- Defined in:
- lib/remap/iteration/hash.rb
Instance Method Summary collapse
- #map(&block) ⇒ Object (also: #call)
Instance Method Details
#map(&block) ⇒ Object Also known as: call
12 13 14 15 16 17 18 19 20 |
# File 'lib/remap/iteration/hash.rb', line 12 def map(&block) value.reduce(init) do |input_state, (key, value)| block[value, key: key]._.then do |new_state| new_state.fmap { { key => _1 } } end.then do |new_hash_state| input_state.merged(new_hash_state) end end._ end |