Skip to content

Commit

Permalink
Merge pull request #173 from JustinCampbell/host_to_parser-downcase
Browse files Browse the repository at this point in the history
Downcase hosts passed to .host_to_parser
  • Loading branch information
weppos committed Jun 21, 2012
2 parents 9145401 + 0c101a2 commit dcffd9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/whois/record/parser.rb
Expand Up @@ -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
Expand Down Expand Up @@ -377,4 +377,4 @@ def any_is?(collection, symbol)
end

end
end
end
4 changes: 4 additions & 0 deletions spec/whois/record/parser_spec.rb
Expand Up @@ -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


Expand Down

0 comments on commit dcffd9c

Please sign in to comment.