Sha256: edee68676ccda5759f6a9e8038ac2481817b141a00091d204b1d20f9794b697e
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require "openapi3_parser/context/pointer" module Openapi3Parser class Context # 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 class Location def self.next_field(location, field) new(location.source, location.pointer.segments + [field]) end attr_reader :source, :pointer # @param [Openapi3Parser::Source] source # @param [::Array] pointer_segments def initialize(source, pointer_segments) @source = source @pointer = Pointer.new(pointer_segments.freeze) end def ==(other) return false unless other.instance_of?(self.class) source == other.source && pointer == other.pointer end def to_s source.relative_to_root + pointer.fragment end def inspect %{#{self.class.name}(source: #{source.inspect}, pointer: #{pointer})} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
openapi3_parser-0.5.1 | lib/openapi3_parser/context/location.rb |
openapi3_parser-0.5.0 | lib/openapi3_parser/context/location.rb |