Class: Remap::Path::Input
- Inherits:
-
Unit
- Object
- Unit
- Remap::Path::Input
- Defined in:
- lib/remap/path/input.rb
Overview
Returns the value at a given path
Instance Method Summary collapse
Instance Method Details
#call(state) {|| ... } ⇒ State
27 28 29 30 31 32 33 34 35 |
# File 'lib/remap/path/input.rb', line 27 def call(state, &iterator) unless iterator raise ArgumentError, "Input path requires an iterator block" end selectors.reverse.reduce(iterator) do |inner_iterator, selector| -> inner_state { selector.call(inner_state, &inner_iterator) } end.call(state) end |
#selectors ⇒ Array<Selector>
19 |
# File 'lib/remap/path/input.rb', line 19 attribute :selectors, [Selector] |