Class Whois::Server::Adapters::Base
In: lib/whois/server/adapters/base.rb
lib/whois/server/adapters/base.rb
Parent: Object

Methods

Constants

DEFAULT_WHOIS_PORT = 43   Default Whois request port.
DEFAULT_WHOIS_PORT = 43   Default Whois request port.

Attributes

allocation  [R] 
allocation  [R] 
buffer  [R] 
buffer  [R] 
host  [R] 
host  [R] 
options  [R] 
options  [R] 
type  [R] 
type  [R] 

Public Class methods

[Source]

# File lib/whois/server/adapters/base.rb, line 37
        def initialize(type, allocation, host, options = {})
          @type       = type
          @allocation = allocation
          @host       = host
          @options    = options || {}
        end

[Source]

# File lib/whois/server/adapters/base.rb, line 37
        def initialize(type, allocation, host, options = {})
          @type       = type
          @allocation = allocation
          @host       = host
          @options    = options || {}
        end

Public Instance methods

Performs a Whois query for qstring using current server adapter and returns a Whois::Response instance with the result of the request.

server.query("google.com") # => Whois::Response

[Source]

# File lib/whois/server/adapters/base.rb, line 51
        def query(qstring)
          with_buffer do |buffer|
            request(qstring)
            Answer.new(self, buffer)
          end
        end

Performs a Whois query for qstring using current server adapter and returns a Whois::Response instance with the result of the request.

server.query("google.com") # => Whois::Response

[Source]

# File lib/whois/server/adapters/base.rb, line 51
        def query(qstring)
          with_buffer do |buffer|
            request(qstring)
            Answer.new(self, buffer)
          end
        end

[Source]

# File lib/whois/server/adapters/base.rb, line 58
        def request(qstring)
          raise NotImplementedError
        end

[Source]

# File lib/whois/server/adapters/base.rb, line 58
        def request(qstring)
          raise NotImplementedError
        end

Protected Instance methods

Store an answer part in @buffer.

[Source]

# File lib/whois/server/adapters/base.rb, line 73
          def append_to_buffer(response, host)
            @buffer << ::Whois::Answer::Part.new(response, host)
          end

Store an answer part in @buffer.

[Source]

# File lib/whois/server/adapters/base.rb, line 73
          def append_to_buffer(response, host)
            @buffer << ::Whois::Answer::Part.new(response, host)
          end

[Source]

# File lib/whois/server/adapters/base.rb, line 77
          def query_the_socket(qstring, host, port = nil)
            ask_the_socket(qstring, host, port || options[:port] || DEFAULT_WHOIS_PORT)
          end

[Source]

# File lib/whois/server/adapters/base.rb, line 77
          def query_the_socket(qstring, host, port = nil)
            ask_the_socket(qstring, host, port || options[:port] || DEFAULT_WHOIS_PORT)
          end

[Source]

# File lib/whois/server/adapters/base.rb, line 65
          def with_buffer(&block)
            @buffer = []
            result = yield(@buffer)
            @buffer = []
            result
          end

[Source]

# File lib/whois/server/adapters/base.rb, line 65
          def with_buffer(&block)
            @buffer = []
            result = yield(@buffer)
            @buffer = []
            result
          end

[Validate]