Class: URLCanonicalize::URI

Inherits:
Object
  • Object
show all
Defined in:
lib/url_canonicalize/uri.rb

Overview

Manage the URL into a URI with local exception handling

Class Method Summary collapse

Class Method Details

.parse(url) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/url_canonicalize/uri.rb', line 6

def parse(url)
  uri = ::URI.parse decorate(url)
  uri if valid? uri
rescue ::URI::InvalidURIError => e
  new_exception = URLCanonicalize::Exception::URI.new("#{e.class}: #{e.message}")
  new_exception.set_backtrace e.backtrace
  raise new_exception
end