Class: GQTP::Backend::Eventmachine::Server
- Inherits:
-
Object
- Object
- GQTP::Backend::Eventmachine::Server
- Defined in:
- lib/gqtp/backend/eventmachine.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Server
constructor
A new instance of Server.
- #run(&block) ⇒ Object
- #shutdown ⇒ Object
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 = @host = [:host] || "0.0.0.0" @port = [:port] || 10043 end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
115 116 117 |
# File 'lib/gqtp/backend/eventmachine.rb', line 115 def host @host end |
#port ⇒ Object
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 |
#shutdown ⇒ Object
128 129 130 |
# File 'lib/gqtp/backend/eventmachine.rb', line 128 def shutdown EventMachine.stop_server(@signature) end |