Class: Factbase::Or
Overview
The ‘or’ term that represents a logical OR operation between multiple operands.
Instance Method Summary collapse
-
#evaluate(fact, maps, fb) ⇒ Boolean
Evaluate term on a fact.
-
#initialize(operands) ⇒ Or
constructor
Constructor.
Methods included from TermShared
Constructor Details
#initialize(operands) ⇒ Or
Constructor.
12 13 14 15 16 |
# File 'lib/factbase/terms/or.rb', line 12 def initialize(operands) super() @operands = operands @op = :or end |
Instance Method Details
#evaluate(fact, maps, fb) ⇒ Boolean
Evaluate term on a fact.
22 23 24 25 26 27 |
# File 'lib/factbase/terms/or.rb', line 22 def evaluate(fact, maps, fb) (0..(@operands.size - 1)).each do |i| return true if Factbase::Boolean.new(_values(i, fact, maps, fb), @operands[i]).bool? end false end |