Class: Factbase::Not

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

Overview

Logical negation (NOT) of an operand.

Instance Method Summary collapse

Methods included from TermShared

#to_s

Constructor Details

#initialize(operands) ⇒ Not

Constructor.



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

def initialize(operands)
  super()
  @operands = operands
  @op = :not
end

Instance Method Details

#evaluate(fact, maps, fb) ⇒ Boolean

Evaluate term on a fact.



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

def evaluate(fact, maps, fb)
  assert_args(1)
  !Factbase::Boolean.new(_values(0, fact, maps, fb), @operands[0]).bool?
end