Class: Rack::Handler::Toycol
- Inherits:
-
Object
- Object
- Rack::Handler::Toycol
- Extended by:
- Toycol::Helper
- Defined in:
- lib/rack/handler/toycol.rb
Class Attribute Summary collapse
-
.host ⇒ Object
writeonly
Sets the attribute host.
-
.port ⇒ Object
writeonly
Sets the attribute port.
-
.preferred_background_server ⇒ Object
writeonly
Sets the attribute preferred_background_server.
Class Method Summary collapse
Methods included from Toycol::Helper
Class Attribute Details
.host=(value) ⇒ Object (writeonly)
Sets the attribute host
11 12 13 |
# File 'lib/rack/handler/toycol.rb', line 11 def host=(value) @host = value end |
.port=(value) ⇒ Object (writeonly)
Sets the attribute port
11 12 13 |
# File 'lib/rack/handler/toycol.rb', line 11 def port=(value) @port = value end |
.preferred_background_server=(value) ⇒ Object (writeonly)
Sets the attribute preferred_background_server
11 12 13 |
# File 'lib/rack/handler/toycol.rb', line 11 def preferred_background_server=(value) @preferred_background_server = value end |
Class Method Details
.run(app, _ = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rack/handler/toycol.rb', line 13 def run(app, _ = {}) @app = app @host ||= ::Toycol::DEFAULT_HOST @port ||= "9292" if (child_pid = fork) ::Toycol::Proxy.new(@host, @port).start Process.waitpid(child_pid) else run_background_server end end |