The new Ruby Whois version will offer the ability to check whether a property is set using the standard method?
Ruby convention. This means, you no longer need to check whether a property is supported, get the property value and compare it to nil
.
a = Whois.query "google.it"
a.created_on?
# => true
a = Whois.query "notregistered.it"
a.created_on?
# => false
Two important aspects to keep in mind. First, this method works only at answer level.
a = Whois.query "google.it"
a.created_on?
# => true
a.parser.created_on?
# => NoMethodError
Second, this method doesn't care whether the property is supported or not. It returns false
either if the property is not supported or the value is nil
.
a = Whois.query "notregistered.it"
# created_on is a property supported
# by .it TLD parser and empty for this
# specific query
a.created_on?
# => false
# domain_is is not a property supported
# by .it TLD parser
a.domain_id?
# => false