Class: Factbase::Type
Overview
Represents a type term in the Factbase. This class evaluates the type of the given operand based on the provided fact, maps, and factbase.
Instance Method Summary collapse
-
#evaluate(fact, _maps, _fb) ⇒ String
Evaluate term on a fact.
-
#initialize(operands) ⇒ Type
constructor
Constructor.
Methods included from TermShared
Constructor Details
#initialize(operands) ⇒ Type
Constructor.
14 15 16 17 |
# File 'lib/factbase/terms/type.rb', line 14 def initialize(operands) super() @operands = operands end |
Instance Method Details
#evaluate(fact, _maps, _fb) ⇒ String
Evaluate term on a fact.
24 25 26 27 28 29 30 |
# File 'lib/factbase/terms/type.rb', line 24 def evaluate(fact, _maps, _fb) assert_args(1) v = _by_symbol(0, fact) return 'nil' if v.nil? v = v[0] if v.respond_to?(:each) && v.size == 1 v.class.to_s end |