Class: Factbase::Prev

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

Overview

of terms based on provided operands and facts.

Instance Method Summary collapse

Methods included from TermShared

#to_s

Constructor Details

#initialize(operands) ⇒ Prev

Constructor.

Parameters:

  • operands (Array)

    Operands



12
13
14
15
# File 'lib/factbase/terms/prev.rb', line 12

def initialize(operands)
  super()
  @operands = operands
end

Instance Method Details

#evaluate(fact, maps, fb) ⇒ Object

Evaluate term on a fact.

Parameters:

Returns:

  • (Object)

    The previous value



22
23
24
25
26
27
28
# File 'lib/factbase/terms/prev.rb', line 22

def evaluate(fact, maps, fb)
  assert_args(1)
  before = @prev
  v = _values(0, fact, maps, fb)
  @prev = v
  before
end