Class: Remap::Rule::Path

Inherits:
Struct
  • Object
show all
Defined in:
lib/remap/rule/support/path.rb

Instance Method Summary collapse

Instance Method Details

#call(state) {|| ... } ⇒ State<T>

Maps state from map to block to to

Parameters:

Yield Parameters:

Yield Returns:

Returns:



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/remap/rule/support/path.rb', line 22

def call(state, &block)
  unless block
    raise ArgumentError, "block required"
  end

  selector(state).then(&block).fmap do |value|
    to.reverse.reduce(value) do |val, key|
      { key => val }
    end
  end._
end