Downcase hosts passed to .host_to_parser #173

Merged
merged 1 commit into from Jun 21, 2012
View
4 lib/whois/record/parser.rb
@@ -114,7 +114,7 @@ def self.parser_klass(host)
# # => "WhoisNicInfoIt"
#
def self.host_to_parser(host)
- host.to_s.
+ host.to_s.downcase.
gsub(/[.-]/, '_').
gsub(/(?:^|_)(.)/) { $1.upcase }
end
@@ -377,4 +377,4 @@ def any_is?(collection, symbol)
end
end
-end
+end
View
4 spec/whois/record/parser_spec.rb
@@ -36,6 +36,10 @@ class PreloadedParserTest
klass.host_to_parser("whois.nic.it").should == "WhoisNicIt"
klass.host_to_parser("whois.domain-registry.nl").should == "WhoisDomainRegistryNl"
end
+
+ it "downcases hostnames" do
+ klass.host_to_parser("whois.PublicDomainRegistry.com").should == "WhoisPublicdomainregistryCom"
+ end
end