Class: Openapi3Parser::SourceInput::Url::RelativeUrlDifference

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi3_parser/source_input/url.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_url, to_url) ⇒ RelativeUrlDifference

Returns a new instance of RelativeUrlDifference.


82
83
84
85
# File 'lib/openapi3_parser/source_input/url.rb', line 82

def initialize(from_url, to_url)
  @from_uri = URI.parse(from_url)
  @to_uri = URI.parse(to_url)
end

Class Method Details

.call(from_url, to_url) ⇒ Object


87
88
89
# File 'lib/openapi3_parser/source_input/url.rb', line 87

def self.call(from_url, to_url)
  new(from_url, to_url).call
end

Instance Method Details

#callObject


91
92
93
94
95
# File 'lib/openapi3_parser/source_input/url.rb', line 91

def call
  return to_uri.to_s if different_hosts?

  relative_path
end