Permalink
Browse files

Downcase hosts passed to .host_to_parser

  • Loading branch information...
1 parent 9145401 commit 0c101a28aed72e83b46b0e90e574561112f0a521 @justincampbell committed Jun 21, 2012
Showing with 6 additions and 2 deletions.
  1. +2 −2 lib/whois/record/parser.rb
  2. +4 −0 spec/whois/record/parser_spec.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
@@ -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

0 comments on commit 0c101a2

Please sign in to comment.