Class: Openapi3Parser::Source::Pointer::MergePointers

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi3_parser/source/pointer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_pointer, new_pointer) ⇒ MergePointers

Returns a new instance of MergePointers.


64
65
66
67
# File 'lib/openapi3_parser/source/pointer.rb', line 64

def initialize(base_pointer, new_pointer)
  @base_pointer = create_pointer(base_pointer)
  @new_pointer = create_pointer(new_pointer)
end

Class Method Details

.call(*args) ⇒ Object


60
61
62
# File 'lib/openapi3_parser/source/pointer.rb', line 60

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject


69
70
71
72
73
74
# File 'lib/openapi3_parser/source/pointer.rb', line 69

def call
  return base_pointer if new_pointer.nil?
  return new_pointer if base_pointer.nil? || new_pointer.absolute

  merge_pointers(base_pointer, new_pointer)
end