lib/page_rankr/site.rb in PageRankr-4.4.1 vs lib/page_rankr/site.rb in PageRankr-4.6.0
- old
+ new
@@ -1,20 +1,20 @@
require 'public_suffix'
require 'delegate'
-require 'uri'
+require 'addressable/uri'
module PageRankr
class Site
COMPONENTS = [:scheme, :subdomain, :domain, :port, :path, :query, :fragment]
def initialize(site)
site = "http://#{site}" unless site =~ /:\/\//
- @uri = URI.parse(site)
+ @uri = Addressable::URI.parse(site)
@domain = PublicSuffix.parse(@uri.host || "")
@domain.valid? or raise DomainInvalid, "The domain provided is invalid.1"
- rescue PublicSuffix::DomainInvalid, URI::InvalidURIError
+ rescue PublicSuffix::DomainInvalid, Addressable::URI::InvalidURIError
raise DomainInvalid, "The domain provided is invalid."
end
def scheme
@uri.scheme
@@ -75,6 +75,6 @@
class << self
def Site(site)
site.respond_to?(:url) ? site : Site.new(site)
end
end
-end
\ No newline at end of file
+end