Permalink
Browse files

Tidy up method internals part 2

* Use Array.wrap - remove registered? as a guard condition
  • Loading branch information...
rorymckinley committed Nov 4, 2012
1 parent f772f38 commit 35b434cc0460bc3ba2ff01de0955ca9de3fc2c19
Showing with 4 additions and 10 deletions.
  1. +4 −10 lib/whois/record/parser/whois.registry.net.za.rb
@@ -38,10 +38,8 @@ class WhoisRegistryNetZa < Base
end
property_supported :nameservers do
- if registered?
- node(:nameservers).map { |nameserver| Record::Nameserver.new(:name => nameserver) }
- else
- []
+ Array.wrap(node(:nameservers)).map do |nameserver|
+ Record::Nameserver.new(:name => nameserver)
end
end
@@ -53,10 +51,8 @@ class WhoisRegistryNetZa < Base
# The response for this property gets wrapped in an array by Whois::Record::Parser::Base#handle_property
property_supported :registrant_contacts do
- if registered?
+ node(:registrant_name) do
build_registrant_contacts
- else
- []
end
end
@@ -88,9 +84,7 @@ def build_registrant_contacts
end
def registrant_details
- node(:registrant_name) do
- { :name => node(:registrant_name), :email => node(:registrant_email), :phone => node(:registrant_telephone), :fax => node(:registrant_fax)}
- end
+ { :name => node(:registrant_name), :email => node(:registrant_email), :phone => node(:registrant_telephone), :fax => node(:registrant_fax)}
end
def registrant_address_details

0 comments on commit 35b434c

Please sign in to comment.