Class: Dry::Logic::Rule::Each
- Inherits:
-
Value
- Object
- Dry::Logic::Rule
- Value
- Dry::Logic::Rule::Each
- Defined in:
- lib/dry/logic/rule/each.rb
Instance Attribute Summary
Attributes inherited from Dry::Logic::Rule
Instance Method Summary collapse
Methods inherited from Value
Methods inherited from Dry::Logic::Rule
#and, #curry, #each?, #initialize, #negation, #new, #or, #predicate_id, #then, #xor
Constructor Details
This class inherits a constructor from Dry::Logic::Rule
Instance Method Details
#apply(input) ⇒ Object
4 5 6 |
# File 'lib/dry/logic/rule/each.rb', line 4 def apply(input) Hash[input.map.with_index { |element, index| [index, predicate.(element)] }] end |
#type ⇒ Object
8 9 10 |
# File 'lib/dry/logic/rule/each.rb', line 8 def type :each end |