Class: SpotFeel::Addition

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

Overview

  1. addition = expression , “+” , expression ;

Instance Method Summary collapse

Methods inherited from Node

#qualified_names_in_context, #raise_evaluation_error

Instance Method Details

#eval(context = {}) ⇒ Object



244
245
246
247
248
249
# File 'lib/spot_feel/nodes.rb', line 244

def eval(context = {})
  head_val = head.eval(context)
  tail_val = tail.eval(context)
  return nil if head_val.nil? || tail_val.nil?
  head.eval(context) + tail.eval(context)
end