Class: Remap::Selector::All
- Inherits:
-
Concrete
- Object
- Concrete
- Remap::Selector::All
- Defined in:
- lib/remap/selector/all.rb
Overview
Selects all elements from a state
Instance Method Summary collapse
-
#call(state) {|| ... } ⇒ State<U>
Iterates over state and passes each value to block.
Instance Method Details
#call(state) {|| ... } ⇒ State<U>
Iterates over state and passes each value to block
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/remap/selector/all.rb', line 26 def call(state, &block) unless block raise ArgumentError, "All selector requires an iteration block" end value = state.fetch(:value) do return state end unless value.is_a?(Enumerable) state.fatal!("Not an enumerator") end state.map(&block) end |