Module: JSON::Util::URI

Defined in:
lib/json-schema/util/uri.rb

Class Method Summary collapse

Class Method Details

.normalized_uri(uri) ⇒ Object


4
5
6
7
8
9
10
11
12
13
# File 'lib/json-schema/util/uri.rb', line 4

def self.normalized_uri(uri)
  uri = Addressable::URI.parse(uri) unless uri.is_a?(Addressable::URI)
  # Check for absolute path
  if uri.relative?
    data = uri.to_s
    data = "#{Dir.pwd}/#{data}" if data[0,1] != '/'
    uri = Addressable::URI.convert_path(data)
  end
  uri
end