Class: Remap::Rule::Collection::Filled
- Inherits:
-
Unit
- Object
- Unit
- Remap::Rule::Collection::Filled
- Defined in:
- lib/remap/rule/support/collection/filled.rb
Overview
Represents a non-empty rule block
Instance Method Summary collapse
-
#call(state, &error) ⇒ State
Represents a non-empty define block with one or more rules Calls every #rules with state and merges the output.
- #rules ⇒ Array<Rule>
Instance Method Details
#call(state, &error) ⇒ State
Represents a non-empty define block with one or more rules Calls every #rules with state and merges the output
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/remap/rule/support/collection/filled.rb', line 26 def call(state, &error) unless error raise ArgumentError, "Collection::Filled#call(state, &error) requires a block" end rules.map do |rule| rule.call(state) do |failure| return error[failure] end end.reduce(&:combine) end |