Class: Factbase::Many

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

Overview

Represents a ‘many’ term in the Factbase that evaluates to true if a property has multiple values. This class is used to check if there are more than one values associated with a specific property in a fact.

Instance Method Summary collapse

Methods included from TermShared

#to_s

Constructor Details

#initialize(operands) ⇒ Many

Constructor.



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

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

Instance Method Details

#evaluate(fact, maps, fb) ⇒ Boolean

Evaluate term on a fact.



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

def evaluate(fact, maps, fb)
  assert_args(1)
  v = _values(0, fact, maps, fb)
  !v.nil? && v.size > 1
end