Class: Factbase::StartsWith

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

Overview

Represents a ‘starts_with’ term in the Factbase. Returns true if any value of the left operand starts with any value of the right.

Instance Method Summary collapse

Methods inherited from TermBase

#to_s

Constructor Details

#initialize(operands) ⇒ StartsWith

Constructor.

Parameters:

  • operands (Array)

    Operands



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

def initialize(operands)
  super()
  @op = Factbase::Compare.new(:start_with?, operands)
end

Instance Method Details

#evaluate(fact, maps, fb) ⇒ Boolean

Evaluate term on a fact.

Parameters:

Returns:

  • (Boolean)

    True if any left value starts with any right value



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

def evaluate(fact, maps, fb)
  @op.evaluate(fact, maps, fb)
end