lib/public_suffix.rb in public_suffix-1.0.0 vs lib/public_suffix.rb in public_suffix-1.1.0
- old
+ new
@@ -1,11 +1,11 @@
#--
# Public Suffix
#
# Domain name parser based on the Public Suffix List.
#
-# Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
+# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
#++
require 'public_suffix/domain'
require 'public_suffix/version'
@@ -19,14 +19,10 @@
NAME = "Public Suffix"
GEM = "public_suffix"
AUTHORS = ["Simone Carletti <weppos@weppos.net>"]
- # Backwards compatibility
- autoload :RuleList, 'public_suffix/rule_list'
-
-
# Parses +domain+ and returns the
# {PublicSuffix::Domain} instance.
#
# Parsing uses the default {PublicSuffix::List}.
#
@@ -65,9 +61,10 @@
# If a rule for +domain+ is found, but the rule
# doesn't allow +domain+.
#
def self.parse(domain)
rule = List.default.find(domain)
+
if rule.nil?
raise DomainInvalid, "`#{domain}' is not a valid domain"
end
if !rule.allow?(domain)
raise DomainNotAllowed, "`#{domain}' is not allowed according to Registry policy"