Class: Spoonerize::Web::Cli
- Inherits:
-
Object
- Object
- Spoonerize::Web::Cli
- Defined in:
- lib/spoonerize/web/cli.rb
Overview
Command-line launcher for the web app.
Constant Summary collapse
- DEFAULT_OPTIONS =
Server options used when no command-line overrides are passed.
{ host: Web.bind, port: Web.port }.freeze
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
Parsed server options.
Class Method Summary collapse
-
.execute(options = []) ⇒ nil
Starts the web app from command-line arguments.
Instance Method Summary collapse
-
#execute ⇒ nil
Starts the Sinatra web app.
-
#initialize(options) ⇒ self
constructor
Create a web CLI launcher.
Constructor Details
#initialize(options) ⇒ self
Create a web CLI launcher.
43 44 45 |
# File 'lib/spoonerize/web/cli.rb', line 43 def initialize() @options = DEFAULT_OPTIONS.merge(parse()) end |
Instance Attribute Details
#options ⇒ Hash (readonly)
Parsed server options.
35 36 37 |
# File 'lib/spoonerize/web/cli.rb', line 35 def @options end |
Class Method Details
.execute(options = []) ⇒ nil
Starts the web app from command-line arguments.
27 28 29 |
# File 'lib/spoonerize/web/cli.rb', line 27 def self.execute( = []) new().execute end |
Instance Method Details
#execute ⇒ nil
Starts the Sinatra web app.
51 52 53 |
# File 'lib/spoonerize/web/cli.rb', line 51 def execute Web.run!(bind: [:host], port: [:port]) end |