Class: SpotFeel::SimplePositiveUnaryTest
- Defined in:
- lib/spot_feel/nodes.rb
Overview
-
simple positive unary test =
7.a [ “<” | “<=” | “>” | “>=” ] , endpoint | 7.b interval ;
Instance Method Summary collapse
Methods inherited from Node
#qualified_names_in_context, #raise_evaluation_error
Instance Method Details
#eval(context = {}) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/spot_feel/nodes.rb', line 81 def eval(context = {}) operator = head.text_value.strip endpoint = tail.eval(context) case operator when "<" ->(input) { input < endpoint } when "<=" ->(input) { input <= endpoint } when ">" ->(input) { input > endpoint } when ">=" ->(input) { input >= endpoint } else ->(input) { input == endpoint } end end |