Method: JSI::JSON::Pointer#parent

Defined in:
lib/jsi/json/pointer.rb

#parentJSI::JSON::Pointer

Returns pointer to the parent of where this pointer points.

Returns:

Raises:



148
149
150
151
152
153
154
# File 'lib/jsi/json/pointer.rb', line 148

def parent
  if root?
    raise(ReferenceError, "cannot access parent of root pointer: #{pretty_inspect.chomp}")
  else
    Pointer.new(reference_tokens[0...-1], type: @type)
  end
end