Class: SpotFeel::FunctionInvocation

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

Overview

  1. function invocation = expression , parameters ;

Instance Method Summary collapse

Methods inherited from Node

#qualified_names_in_context, #raise_evaluation_error

Instance Method Details

#eval(context = {}) ⇒ Object



384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/spot_feel/nodes.rb', line 384

def eval(context = {})
  fn = context[fn_name.text_value.to_sym]

  unless fn
    raise_evaluation_error(fn_name.text_value, context) if SpotFeel.config.strict
    return nil
  end

  args = params.present? ? params.eval(context) : []

  fn.call(*args)
end