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, #contains_input_placeholder?, #qualified_names_in_context, #raise_evaluation_error

Instance Method Details

#eval(context = {}) ⇒ Object



491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
# File 'lib/feel/nodes.rb', line 491

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