Class: Dry::Logic::Rule::Each

Inherits:
Dry::Logic::Rule show all
Defined in:
lib/dry/logic/rule/each.rb

Instance Attribute Summary

Attributes inherited from Dry::Logic::Rule

#name, #predicate

Instance Method Summary collapse

Methods inherited from Dry::Logic::Rule

#and, #curry, #initialize, #negation, #new, #or, #predicate_id, #then, #to_ary, #xor

Constructor Details

This class inherits a constructor from Dry::Logic::Rule

Instance Method Details

#call(input) ⇒ Object



4
5
6
# File 'lib/dry/logic/rule/each.rb', line 4

def call(input)
  Logic.Result(input, input.map { |element| predicate.(element) }, self)
end

#typeObject



8
9
10
# File 'lib/dry/logic/rule/each.rb', line 8

def type
  :each
end