Class: FEEL::FunctionInvocation

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

Overview

  1. function invocation = expression , parameters ;

Instance Method Summary collapse

Methods inherited from Node

#access_property, #qualified_names_in_context, #raise_evaluation_error

Instance Method Details

#eval(context = {}) ⇒ Object



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/feel/nodes.rb', line 473

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

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

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

  result = fn.call(*args)
  if defined?(property) && property.present?
    result = access_property(result, property.name.eval(context))
  end
  result
end