Method: Janeway::Functions#parse_function_parameter

Defined in:
lib/janeway/functions.rb

#parse_function_parameterString, ...

All jsonpath function parameters are one of these accepted types. Parse the function parameter and return the result.

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/janeway/functions.rb', line 42

def parse_function_parameter
  result =
    case current.type
    when :string then parse_string
    when :current_node then parse_current_node
    when :root then parse_root
    when :group_end then raise Error, 'Function call is missing parameter'
    else
      # Invalid, no function uses this.
      # Instead of crashing here, accept it and let the function return an empty result.
      parse_expr
    end
  consume
  result
end