Method: JSI::Ptr#evaluate

Defined in:
lib/jsi/ptr.rb

#evaluate(document, *a, **kw) ⇒ Object

takes a root json document and evaluates this pointer through the document, returning the value pointed to by this pointer.

Parameters:

  • document (#to_ary, #to_hash)

    the document against which we will evaluate this pointer

  • a

    arguments are passed to each invocation of #[]

Returns:

  • (Object)

    the content of the document pointed to by this pointer

Raises:



124
125
126
127
128
129
130
# File 'lib/jsi/ptr.rb', line 124

def evaluate(document, *a, **kw)
  res = tokens.inject(document) do |value, token|
    _, child = node_subscript_token_child(value, token, *a, **kw)
    child
  end
  res
end