Class: Factbase::Plus

Inherits:
TermBase show all
Defined in:
lib/factbase/terms/plus.rb

Overview

Represents a Plus term in the Factbase system. This class is used to perform addition operations on operands.

Instance Method Summary collapse

Methods included from TermShared

#to_s

Constructor Details

#initialize(operands) ⇒ Plus

Constructor.

Parameters:

  • operands (Array)

    Operands



14
15
16
17
# File 'lib/factbase/terms/plus.rb', line 14

def initialize(operands)
  super()
  @plus = Factbase::Arithmetic.new(:+, operands)
end

Instance Method Details

#evaluate(fact, maps, fb) ⇒ Object

Evaluate term on a fact.

Parameters:

Returns:

  • (Object)

    Result of the addition



24
25
26
# File 'lib/factbase/terms/plus.rb', line 24

def evaluate(fact, maps, fb)
  @plus.evaluate(fact, maps, fb)
end