Class: SpotFeel::Comparison

Inherits:
Node
  • Object
show all
Defined in:
lib/spot_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

#qualified_names_in_context, #raise_evaluation_error

Instance Method Details

#eval(context = {}) ⇒ Object



493
494
495
496
497
498
499
500
501
502
# File 'lib/spot_feel/nodes.rb', line 493

def eval(context = {})
  case operator.text_value
  when '<' then left.eval(context) < right.eval(context)
  when '<=' then left.eval(context) <= right.eval(context)
  when '>=' then left.eval(context) >= right.eval(context)
  when '>' then left.eval(context) > right.eval(context)
  when '!=' then left.eval(context) != right.eval(context)
  when '=' then left.eval(context) == right.eval(context)
  end
end