Class: GQTP::Backend::Eventmachine::Server

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Server

Returns a new instance of Server.



116
117
118
119
120
# File 'lib/gqtp/backend/eventmachine.rb', line 116

def initialize(options={})
  @options = options
  @host = options[:host] || "0.0.0.0"
  @port = options[:port] || 10043
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



115
116
117
# File 'lib/gqtp/backend/eventmachine.rb', line 115

def host
  @host
end

#portObject

Returns the value of attribute port.



115
116
117
# File 'lib/gqtp/backend/eventmachine.rb', line 115

def port
  @port
end

Instance Method Details

#run(&block) ⇒ Object



122
123
124
125
126
# File 'lib/gqtp/backend/eventmachine.rb', line 122

def run(&block)
  @signature =
    EventMachine.start_server(@host, @port, ServerHandler, block)
  Request.new
end

#shutdownObject



128
129
130
# File 'lib/gqtp/backend/eventmachine.rb', line 128

def shutdown
  EventMachine.stop_server(@signature)
end