Class: Apiwork::JSONPointer
- Inherits:
-
Object
- Object
- Apiwork::JSONPointer
- Defined in:
- lib/apiwork/json_pointer.rb
Instance Method Summary collapse
-
#initialize(*path) ⇒ JSONPointer
constructor
A new instance of JSONPointer.
- #to_s ⇒ Object
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_s ⇒ Object
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 |