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 26 27 28 |
# File 'lib/oxidized/web.rb', line 9 def initialize(nodes, listen) require 'oxidized/web/webapp' listen, uri = listen.split '/' addr, _, port = listen.rpartition ':' unless port port = addr addr = nil end uri = "/#{uri}" @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
30 31 32 33 34 35 |
# File 'lib/oxidized/web.rb', line 30 def run @thread = Thread.new do Rack::Handler::Puma.run @app, **@opts exit! end end |