Class: DecisionAgent::Dmn::Feel::Functions::Count

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

Overview

LIST FUNCTIONS

Class Method Summary collapse

Methods inherited from Base

register, validate_arg_count

Class Method Details

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



238
239
240
241
242
243
244
# File 'lib/decision_agent/dmn/feel/functions.rb', line 238

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.length
end