Class: Factbase::Exists

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

Overview

Represents a term that checks if a certain condition exists within the factbase. This class evaluates whether a specific term exists in the given context of facts.

Instance Method Summary collapse

Methods included from TermShared

#to_s

Constructor Details

#initialize(operands) ⇒ Exists

Constructor.



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

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

Instance Method Details

#evaluate(fact, _maps, _fb) ⇒ Boolean

Evaluate term on a fact.



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

def evaluate(fact, _maps, _fb)
  assert_args(1)
  !_by_symbol(0, fact).nil?
end