Class | Whois::Answer::Parser::Base |
In: |
lib/whois/answer/parser/base.rb
|
Parent: | Object |
Registers a property as :not_implemented and defines a method which will raise a PropertyNotImplemented error.
# Defines a not implemented property called :disclaimer. property_not_implemented(:disclaimer) do ... end # def disclaimer # raise PropertyNotImplemented, "You should overwrite this method." # end
Registers a property as :not_supported and defines a method which will raise a PropertyNotSupported error.
# Defines an unsupported property called :disclaimer. property_not_supported(:disclaimer) do ... end # def disclaimer # raise PropertyNotSupported # end
Returns true if the property passed as symbol is registered in the property_registry for current parser.
property_registered?(:disclaimer) # => false register_property(:discaimer) {} property_registered?(:disclaimer) # => true
Returns the @@property_registry if klass is nil, otherwise returns the value in @@property_registry for given klass. klass is expected to be a class name.
Returned value is always a hash. If @@property_registry[klass] doesn‘t exist, this method automatically initializes it to an empty Hash.
Returns the status for property passed as symbol.
property_status(:disclaimer) # => nil register_property(:discaimer, :supported) {} property_status(:disclaimer) # => :supported
Registers a property as :supported and defines a method with the content of the block.
# Defines a supported property called :disclaimer. property_supported(:disclaimer) do ... end # def disclaimer # ... # end
This method creates a new method called property with the content of block and registers the property in the property_registry with given status.
register_property(:disclaimer, :supported) do ... end # def disclaimer # ... # end property_registered?(:disclaimer) # => true register_property(:changed?, :implemented) do |other| ... end # def changed?(other) # ... # end
@deprecated {admin} is deprecated
and will be removed in a future version. Use {#admin_contact}.
Gets all supported contacts merged into a single Array.
Returns an Array of Whois::Aswer::Contact.
This is an internal method primaly used as a common access point to get the content to be parsed as a string.
The main reason behind this method is because I changed the internal representation of the data to be parsed more than once and I always had to rewrite all single parsers in order to reflect these changes. Now, as far as the parser access the data via the content method, there‘s no need to change each single implementation in case the content source changes.
That said, the only constraints about this method is to return the data to be parsed as string.
@deprecated {registrant} is deprecated
and will be removed in a future version. Use {#registrant_contact}.
@deprecated {technical} is deprecated
and will be removed in a future version. Use {#technical_contact}.
NEWPROPERTY
Checks whether this is a throttle response. The default implementation always returns false.
This method is intended to be overrridden by child classes.
Returns false by default.