Default bind hostname.
Default WHOIS request port.
@param [Symbol] type
The type of WHOIS adapter to define. Known values are :tld, :ipv4, :ipv6.
@param [String] allocation
The allocation, range or hostname, this server is responsible for.
@param [String, nil] host
The server hostname. Use nil if unknown or not available.
@param [Hash] options Optional adapter properties.
# File lib/whois/server/adapters/base.rb, line 54 def initialize(type, allocation, host, options = {}) @type = type @allocation = allocation @host = host @options = options || {} end
Checks self and other for equality.
@param [The Whois::Server::Adapters::Base] other @return [Boolean] Returns true if the other is the same object,
or <tt>other</tt> attributes matches this object attributes.
# File lib/whois/server/adapters/base.rb, line 67 def ==(other) ( self.equal?(other) ) || ( other.is_a?(self.class) && self.type == other.type && self.allocation == other.allocation && self.host == other.host && self.options == other.options ) end
Merges given settings into current {options}.
@param [Hash] settings @return [Hash] The updated options for this object.
# File lib/whois/server/adapters/base.rb, line 87 def configure(settings) @host = settings[:host] if settings[:host] options.merge!(settings) end
Performs a Whois lookup for string using the current server adapter.
Internally, this method calls {request} using the Template Method design pattern.
server.lookup("google.com") # => Whois::Record
@param [String] string The string to be sent as query parameter. @return [Whois::Record]
# File lib/whois/server/adapters/base.rb, line 105 def lookup(string) buffer_start do |buffer| request(string) Whois::Record.new(self, buffer) end end
Performs the real WHOIS request.
This method is not implemented in {Whois::Server::Adapters::Base} class, it is intended to be overwritten in the concrete subclasses. This is the heart of the Template Method design pattern.
@param [String] string The string to be sent as query parameter. @return [void] @raise [NotImplementedError] @abstract
# File lib/whois/server/adapters/base.rb, line 123 def request(string) raise NotImplementedError end
Generated with the Darkfish Rdoc Generator 2.