Class: Apiwork::JSONPointer

Inherits:
Object
  • Object
show all
Defined in:
lib/apiwork/json_pointer.rb

Instance Method Summary collapse

Constructor Details

#initialize(*path) ⇒ JSONPointer

Returns a new instance of JSONPointer.



5
6
7
# File 'lib/apiwork/json_pointer.rb', line 5

def initialize(*path)
  @path = path
end

Instance Method Details

#to_sObject



9
10
11
12
13
# File 'lib/apiwork/json_pointer.rb', line 9

def to_s
  return '' if @path.empty?

  "/#{@path.map { |component| escape(component.to_s) }.join('/')}"
end