Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Downcase hosts passed to .host_to_parser #173

Merged
merged 1 commit into from

2 participants

@justincampbell

This was raising an error while writing a parser for whois.publicdomainregistry.com. The whois server for resellerclub.com returned in the initial response is camel-cased.

$ whois resellerclub.com
...
Whois Server: whois.PublicDomainRegistry.com
...
@weppos weppos merged commit dcffd9c into from
@weppos
Owner

Merged, thank you!

@weppos weppos referenced this pull request from a commit
@weppos Update CHANGELOG for GH-173 65bd18d
@weppos weppos was assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 21, 2012
  1. @justincampbell
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.