class Openapi3Parser::Source::Location
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
Attributes
pointer[R]
source[R]
Public Class Methods
new(source, pointer_segments)
click to toggle source
@param [Openapi3Parser::Source] source @param [::Array] pointer_segments
# File lib/openapi3_parser/source/location.rb, line 22 def initialize(source, pointer_segments) @source = source @pointer = Pointer.new(pointer_segments.freeze) end
next_field(location, field)
click to toggle source
# File lib/openapi3_parser/source/location.rb, line 13 def self.next_field(location, field) new(location.source, location.pointer.segments + [field]) end
Public Instance Methods
==(other)
click to toggle source
# File lib/openapi3_parser/source/location.rb, line 27 def ==(other) return false unless other.instance_of?(self.class) source == other.source && pointer == other.pointer end
data()
click to toggle source
# File lib/openapi3_parser/source/location.rb, line 37 def data source.data_at_pointer(pointer.segments) end
inspect()
click to toggle source
# File lib/openapi3_parser/source/location.rb, line 49 def inspect %{#{self.class.name}(source: #{source.inspect}, pointer: #{pointer})} end
pointer_defined?()
click to toggle source
# File lib/openapi3_parser/source/location.rb, line 41 def pointer_defined? source.has_pointer?(pointer.segments) end
source_available?()
click to toggle source
# File lib/openapi3_parser/source/location.rb, line 45 def source_available? source.available? end
to_s()
click to toggle source
# File lib/openapi3_parser/source/location.rb, line 33 def to_s source.relative_to_root + pointer.fragment end