Class: DecisionAgent::Dmn::Feel::Functions::Sum

Inherits:
Base
  • Object
show all
Defined in:
lib/decision_agent/dmn/feel/functions.rb

Class Method Summary collapse

Methods inherited from Base

register, validate_arg_count

Class Method Details

.call(args, _context = {}) ⇒ Object



250
251
252
253
254
255
256
# File 'lib/decision_agent/dmn/feel/functions.rb', line 250

def self.call(args, _context = {})
  validate_arg_count(args, 1)
  list = args[0]
  return 0 unless list.is_a?(Array) || list.is_a?(Types::List)

  list.map(&:to_f).sum
end