lib/gman/identifier.rb in gman-4.7.1 vs lib/gman/identifier.rb in gman-5.0.0
- old
+ new
@@ -1,6 +1,6 @@
-class Gman < NaughtyOrNice
+class Gman
def type
if state?
:state
elsif district?
@@ -40,11 +40,11 @@
def agency
dotgov_listing["Agency"] if federal?
end
def dotgov?
- domain_parts.tld == "gov"
+ domain.tld == "gov"
end
def federal?
dotgov_listing && dotgov_listing["Domain Type"] == "Federal Agency"
end
@@ -83,20 +83,20 @@
private
def list_category
@list_category ||= begin
- if match = Gman.list.find(domain)
+ if match = Gman.list.find(domain.to_s)
regex = Regexp.new "\/\/ ([^\\n]+)\\n?[^\/\/]*\\n#{Regexp.escape(match.name)}\\n", "im"
matches = Gman.list_contents.match(regex)
matches[1] if matches
end
end
end
def matches
- @matches ||= domain.match(LOCALITY_REGEX)
+ @matches ||= domain.to_s.match(LOCALITY_REGEX)
end
def self.dotgov_list_path
File.join Gman.config_path, "vendor/dotgovs.csv"
end
@@ -104,8 +104,8 @@
def self.dotgov_list
@dotgov_list ||= CSV.read(dotgov_list_path, :headers => true)
end
def dotgov_listing
- @dotgov_listing ||= Gman.dotgov_list.find { |d| d["Domain Name"].downcase == "#{domain_parts.sld}.gov" } if dotgov?
+ @dotgov_listing ||= Gman.dotgov_list.find { |d| d["Domain Name"].downcase == "#{domain.sld}.gov" } if dotgov?
end
end