Method: I2P::BOB::Client#initialize

Defined in:
lib/i2p/bob/client.rb

#initialize(options = {}) {|client| ... } ⇒ Client

Initializes a new client instance.

Parameters:

  • options (Hash{Symbol => Object}) (defaults to: {})

Options Hash (options):

  • :host (String, #to_s) — default: DEFAULT_HOST
  • :port (Integer, #to_i) — default: DEFAULT_PORT

Yields:

  • (client)

Yield Parameters:

Since:

  • 0.1.4



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/i2p/bob/client.rb', line 103

def initialize(options = {}, &block)
  @options = options.dup
  @host    = (@options.delete(:host) || DEFAULT_HOST).to_s
  @port    = (@options.delete(:port) || DEFAULT_PORT).to_i

  if block_given?
    case block.arity
      when 1 then block.call(self)
      else instance_eval(&block)
    end
  end
end