Class: Nephos::Server
- Inherits:
-
Object
- Object
- Nephos::Server
- Defined in:
- lib/nephos-server/server/main.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
Class Method Summary collapse
-
.start(port, host) ⇒ Object
start the Rack server on a instance of Nephos::Server.
Instance Method Summary collapse
-
#initialize(port = "8080", host = "0.0.0.0") ⇒ Server
constructor
A new instance of Server.
-
#start ⇒ Object
start the Rack server.
Constructor Details
#initialize(port = "8080", host = "0.0.0.0") ⇒ Server
Returns a new instance of Server.
11 12 13 14 15 16 17 18 |
# File 'lib/nephos-server/server/main.rb', line 11 def initialize port="8080", host="0.0.0.0" @port = Integer(port) @host = host.to_s @server = lambda {|env| router = Router.new return router.execute(Rack::Request.new(env)) } end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
8 9 10 |
# File 'lib/nephos-server/server/main.rb', line 8 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
8 9 10 |
# File 'lib/nephos-server/server/main.rb', line 8 def port @port end |
Class Method Details
Instance Method Details
#start ⇒ Object
start the Rack server
21 22 23 |
# File 'lib/nephos-server/server/main.rb', line 21 def start Rack::Server.start :app => @server, :Port => @port, :Host => @host end |