Class: Puma::Single
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Runner
|
|
|
Instance Chain:
self,
Runner,
Const::PipeRequest
|
|
| Inherits: |
Puma::Runner
|
| Defined in: | lib/puma/single.rb |
Overview
This class is instantiated by the Launcher and used to boot and serve a Ruby application when no puma “workers” are needed i.e. only using “threaded” mode. For example $ puma -t 1:5
At the core of this class is running an instance of Server which gets created via the start_server method from the Runner class that this inherits from.
Constant Summary
Const::PipeRequest - Included
PIPE_BOOT, PIPE_EXTERNAL_TERM, PIPE_FORK, PIPE_IDLE, PIPE_PING, PIPE_TERM, PIPE_WAKEUP
Class Method Summary
Instance Attribute Summary
- #stats readonly
Runner - Inherited
| #app, #development?, | |
| #options | Returns the hash of configuration options. |
| #redirected_io?, #ruby_engine, #test? | |
Instance Method Summary
Runner - Inherited
| #close_control_listeners, #debug, #error, #load_and_bind, #log, #output_header, #redirect_io, #start_control, #start_server, #stop_control, #wakeup!, | |
| #debug_loaded_extensions | this method call should always be guarded by |
| #ensure_output_directory_exists, #stats, #utc_iso8601 | |
Constructor Details
This class inherits a constructor from Puma::Runner
Instance Attribute Details
#stats (readonly)
[ GitHub ]# File 'lib/puma/single.rb', line 17
def stats { started_at: utc_iso8601(@started_at) }.merge(@server&.stats || {}).merge(super) end
Instance Method Details
#halt
[ GitHub ]# File 'lib/puma/single.rb', line 31
def halt @server&.halt end
#restart
[ GitHub ]# File 'lib/puma/single.rb', line 23
def restart @server&.begin_restart end
#run
[ GitHub ]# File 'lib/puma/single.rb', line 41
def run output_header "single" load_and_bind Plugins.fire_background @launcher.write_state start_control @server = server = start_server server_thread = server.run log "Use Ctrl-C to stop" redirect_io @events.fire_on_booted! debug_loaded_extensions("Loaded Extensions:") if @log_writer.debug? begin server_thread.join rescue Interrupt # Swallow it end end
#stop
[ GitHub ]# File 'lib/puma/single.rb', line 27
def stop @server&.stop false end