Class: Jimson::Server
- Inherits:
-
Object
- Object
- Jimson::Server
- Defined in:
- lib/jimson/server.rb
Instance Attribute Summary collapse
-
#handler ⇒ Object
Returns the value of attribute handler.
-
#host ⇒ Object
Returns the value of attribute host.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(handler, host = '0.0.0.0', port = 8999, logger = Logger.new(STDOUT)) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize(handler, host = '0.0.0.0', port = 8999, logger = Logger.new(STDOUT)) ⇒ Server
Returns a new instance of Server.
147 148 149 150 151 152 |
# File 'lib/jimson/server.rb', line 147 def initialize(handler, host = '0.0.0.0', port = 8999, logger = Logger.new(STDOUT)) @handler = handler @host = host @port = port @logger = logger end |
Instance Attribute Details
#handler ⇒ Object
Returns the value of attribute handler.
145 146 147 |
# File 'lib/jimson/server.rb', line 145 def handler @handler end |
#host ⇒ Object
Returns the value of attribute host.
145 146 147 |
# File 'lib/jimson/server.rb', line 145 def host @host end |
#logger ⇒ Object
Returns the value of attribute logger.
145 146 147 |
# File 'lib/jimson/server.rb', line 145 def logger @logger end |
#port ⇒ Object
Returns the value of attribute port.
145 146 147 |
# File 'lib/jimson/server.rb', line 145 def port @port end |
Instance Method Details
#start ⇒ Object
154 155 156 157 158 159 160 |
# File 'lib/jimson/server.rb', line 154 def start Jimson::HttpServer.handler = @handler EM.run do EM::start_server(@host, @port, Jimson::HttpServer) @logger.info("Server listening on #{@host}:#{@port} with handler '#{@handler}'") end end |