Permalink
Browse files

Make status mapping more restrictive

  • Loading branch information...
weppos committed Jul 3, 2012
1 parent 9ee0fda commit f9d6d5d46f0861e5409d919936e2665d468ef2ae
Showing with 9 additions and 10 deletions.
  1. +8 −10 lib/whois/record/parser/base_whoisd.rb
  2. +1 −0 lib/whois/record/parser/whois.nic.cz.rb
@@ -21,18 +21,16 @@ class Parser
# @since RELEASE
class BaseWhoisd < Base
+ class_attribute :status_mapping
+ self.status_mapping = {
+ 'paid and in zone' => :registered,
+ 'expired' => :expired,
+ }
+
property_supported :status do
if content_for_scanner =~ /status:\s+(.+)\n/
- case $1.downcase
- when "paid and in zone"
- :registered
- when "update prohibited"
- :registered
- when "expired"
- :expired
- else
- Whois.bug!(ParserError, "Unknown status `#{$1}'.")
- end
+ self.class.status_mapping[$1.downcase] ||
+ Whois.bug!(ParserError, "Unknown status `#{$1}'.")
else
:available
end
@@ -24,6 +24,7 @@ class Parser
# The Example parser for the list of all available methods.
#
class WhoisNicCz < BaseWhoisd
+ self.status_mapping.merge!('update prohibited' => :registered)
end
end

0 comments on commit f9d6d5d

Please sign in to comment.