Module: DecisionAgent::Dmn::Feel::Functions

Defined in:
lib/decision_agent/dmn/feel/functions.rb

Overview

Built-in FEEL functions registry Functions either map to ConditionEvaluator operators or provide custom evaluation

Defined Under Namespace

Classes: Abs, All, Any, Append, Base, Ceiling, Contains, Count, DateFunction, DistinctValues, DurationFunction, EndsWith, Even, Floor, IndexOf, LowerCase, Max, Mean, Min, Modulo, Not, Odd, Replace, Reverse, Round, Sqrt, StartsWith, StringLength, Substring, SubstringAfter, SubstringBefore, Sum, TimeFunction, UpperCase

Constant Summary collapse

REGISTRY =

Function registry rubocop:disable Style/MutableConstant

{}

Class Method Summary collapse

Class Method Details

.execute(name, args, context = {}) ⇒ Object

Execute a function

Raises:



408
409
410
411
412
413
# File 'lib/decision_agent/dmn/feel/functions.rb', line 408

def self.execute(name, args, context = {})
  func = get(name)
  raise FeelFunctionError, "Unknown function: #{name}" unless func

  func.call(args, context)
end

.get(name) ⇒ Object

Lookup function by name



403
404
405
# File 'lib/decision_agent/dmn/feel/functions.rb', line 403

def self.get(name)
  REGISTRY[name.to_s]
end

.listObject

List all registered functions



416
417
418
# File 'lib/decision_agent/dmn/feel/functions.rb', line 416

def self.list
  REGISTRY.keys.sort
end