Class: Oxidized::API::Web
- Inherits:
-
Object
- Object
- Oxidized::API::Web
- Defined in:
- lib/oxidized/web.rb
Instance Attribute Summary collapse
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
-
#initialize(nodes, listen) ⇒ Web
constructor
A new instance of Web.
- #run ⇒ Object
Constructor Details
#initialize(nodes, listen) ⇒ Web
Returns a new instance of Web.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/oxidized/web.rb', line 9 def initialize nodes, listen require 'oxidized/web/webapp' listen, uri = listen.split '/' addr, _, port = listen.rpartition ':' port, addr = addr, nil if not port uri = '/' + uri.to_s @opts = { Host: addr, Port: port, } WebApp.set :nodes, nodes @app = Rack::Builder.new do map uri do run WebApp end end end |
Instance Attribute Details
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
7 8 9 |
# File 'lib/oxidized/web.rb', line 7 def thread @thread end |
Instance Method Details
#run ⇒ Object
27 28 29 30 31 32 |
# File 'lib/oxidized/web.rb', line 27 def run @thread = Thread.new do Rack::Handler::Puma.run @app, @opts exit! end end |