Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #173 from JustinCampbell/host_to_parser-downcase

Downcase hosts passed to .host_to_parser
  • Loading branch information...
commit dcffd9c748b7bfbabfd3ddf40576a536bab2014a 2 parents 9145401 + 0c101a2
@weppos authored
Showing with 6 additions and 2 deletions.
  1. +2 −2 lib/whois/record/parser.rb
  2. +4 −0 spec/whois/record/parser_spec.rb
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
Please sign in to comment.
Something went wrong with that request. Please try again.