Method: FEEL::Interval#eval

Defined in:
lib/feel/nodes.rb

#eval(context = {}) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/feel/nodes.rb', line 110

def eval(context = {})
  start = start_token.text_value
  finish = end_token.text_value
  first_val = first.eval(context)
  second_val = second.eval(context)

  case [start, finish]
  when ["(", ")"]
    ->(input) { first_val < input && input < second_val }
  when ["[", "]"]
    ->(input) { first_val <= input && input <= second_val }
  when ["(", "]"]
    ->(input) { first_val < input && input <= second_val }
  when ["[", ")"]
    ->(input) { first_val <= input && input < second_val }
  end
end