Class: Dry::Logic::Rule::Conjunction

Inherits:
Composite show all
Defined in:
lib/dry/logic/rule/composite.rb

Instance Attribute Summary

Attributes inherited from Composite

#left, #right

Attributes inherited from Dry::Logic::Rule

#options, #predicate

Instance Method Summary collapse

Methods inherited from Composite

#initialize, #name, #to_ast

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::Composite

Instance Method Details

#call(input) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/dry/logic/rule/composite.rb', line 38

def call(input)
  result = left.(input)

  if result.success?
    right.(input)
  else
    result
  end
end

#typeObject



48
49
50
# File 'lib/dry/logic/rule/composite.rb', line 48

def type
  :and
end