Class: FEEL::Comparison

Inherits:
Node
  • Object
show all
Defined in:
lib/feel/nodes.rb

Overview

  1. comparison =

51.a expression , ( “=” | “!=” | “<” | “<=” | “>” | “>=” ) , expression | 51.b expression , “between” , expression , “and” , expression | 51.c expression , “in” , positive unary test ; 51.d expression , “in” , “ (”, positive unary tests, “)” ;

Instance Method Summary collapse

Methods inherited from Node

#access_property, #qualified_names_in_context, #raise_evaluation_error

Instance Method Details

#eval(context = {}) ⇒ Object



586
587
588
589
590
591
592
593
594
595
596
# File 'lib/feel/nodes.rb', line 586

def eval(context = {})
  left_val = left.eval(context)
  right_val = right.eval(context)
  case operator.text_value
  when "<", "<=", ">=", ">"
    return nil if left_val.nil? || right_val.nil?
    left_val.send(operator.text_value, right_val)
  when "!=" then left_val != right_val
  when "=" then left_val == right_val
  end
end