Class: GQTP::Backend::Eventmachine::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/gqtp/backend/eventmachine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



80
81
82
83
84
85
# File 'lib/gqtp/backend/eventmachine.rb', line 80

def initialize(options={})
  @options = options
  @host = options[:host] || "127.0.0.1"
  @port = options[:port] || 10043
  @connection = EventMachine.connect(@host, @port, Handler)
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



79
80
81
# File 'lib/gqtp/backend/eventmachine.rb', line 79

def host
  @host
end

#portObject

Returns the value of attribute port.



79
80
81
# File 'lib/gqtp/backend/eventmachine.rb', line 79

def port
  @port
end

Instance Method Details

#closeObject



95
96
97
# File 'lib/gqtp/backend/eventmachine.rb', line 95

def close
  @connection.close_connection_after_writing
end

#read(size, &block) ⇒ Object



91
92
93
# File 'lib/gqtp/backend/eventmachine.rb', line 91

def read(size, &block)
  @connection.read(size, &block)
end

#write(*chunks, &block) ⇒ Object



87
88
89
# File 'lib/gqtp/backend/eventmachine.rb', line 87

def write(*chunks, &block)
  @connection.write(*chunks, &block)
end