Class: Openapi3Parser::Context::Location
- Inherits:
-
Object
- Object
- Openapi3Parser::Context::Location
- Defined in:
- lib/openapi3_parser/context/location.rb
Overview
Class used to represent a location within an OpenAPI document. It contains a source, which is the source file/data used for the contents and the pointer which indicates where in the object like file the data is
Instance Attribute Summary collapse
-
#pointer ⇒ Object
readonly
Returns the value of attribute pointer.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(source, pointer_segments) ⇒ Location
constructor
A new instance of Location.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#pointer ⇒ Object (readonly)
Returns the value of attribute pointer.
15 16 17 |
# File 'lib/openapi3_parser/context/location.rb', line 15 def pointer @pointer end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
15 16 17 |
# File 'lib/openapi3_parser/context/location.rb', line 15 def source @source end |
Class Method Details
.next_field(location, field) ⇒ Object
11 12 13 |
# File 'lib/openapi3_parser/context/location.rb', line 11 def self.next_field(location, field) new(location.source, location.pointer.segments + [field]) end |
Instance Method Details
#==(other) ⇒ Object
24 25 26 |
# File 'lib/openapi3_parser/context/location.rb', line 24 def ==(other) source == other.source && pointer == other.pointer end |
#inspect ⇒ Object
32 33 34 |
# File 'lib/openapi3_parser/context/location.rb', line 32 def inspect %{#{self.class.name}(source: #{source.inspect}, pointer: #{pointer})} end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/openapi3_parser/context/location.rb', line 28 def to_s source.relative_to_root + pointer.fragment end |