Class: JSONP3::Path::Length

Inherits:
FunctionExtension show all
Defined in:
lib/json_p3/path/function_extensions/length.rb

Overview

The standard length function.

Constant Summary collapse

ARG_TYPES =
[:value_expression].freeze
RETURN_TYPE =
:value_expression

Instance Method Summary collapse

Instance Method Details

#call(obj) ⇒ Object



10
11
12
13
14
# File 'lib/json_p3/path/function_extensions/length.rb', line 10

def call(obj)
  return :nothing unless obj.is_a?(Array) || obj.is_a?(Hash) || obj.is_a?(String)

  obj.length
end