Class: Remap::Iteration::Hash

Inherits:
Concrete
  • Object
show all
Defined in:
lib/remap/iteration/hash.rb

Instance Method Summary collapse

Instance Method Details

#map(&block) ⇒ Object Also known as: call

See Also:

  • Base#map


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