Class: Vizcore::Server::GalleryRunner
- Inherits:
-
Object
- Object
- Vizcore::Server::GalleryRunner
- Defined in:
- lib/vizcore/server/gallery_runner.rb
Overview
Starts a small Rack/Puma server for the example gallery.
Constant Summary collapse
- DEFAULT_PORT =
Config::DEFAULT_PORT + 1
Instance Method Summary collapse
-
#initialize(host: Config::DEFAULT_HOST, port: DEFAULT_PORT, output: $stdout) ⇒ GalleryRunner
constructor
A new instance of GalleryRunner.
- #run ⇒ void
Constructor Details
#initialize(host: Config::DEFAULT_HOST, port: DEFAULT_PORT, output: $stdout) ⇒ GalleryRunner
Returns a new instance of GalleryRunner.
16 17 18 19 20 |
# File 'lib/vizcore/server/gallery_runner.rb', line 16 def initialize(host: Config::DEFAULT_HOST, port: DEFAULT_PORT, output: $stdout) @host = host @port = Integer(port) @output = output end |
Instance Method Details
#run ⇒ void
This method returns an undefined value.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vizcore/server/gallery_runner.rb', line 23 def run server = Puma::Server.new(GalleryApp.new, nil, min_threads: 0, max_threads: 4) server.add_tcp_listener(@host, @port) server.run @output.puts("Vizcore gallery: http://#{@host}:#{@port}") @output.puts("Press Ctrl+C to stop.") wait_for_interrupt ensure server&.stop(true) end |