Class: Plz::CommandBuilder
- Inherits:
-
Object
- Object
- Plz::CommandBuilder
- Defined in:
- lib/plz/command_builder.rb
Constant Summary collapse
- SCHEMA_FILE_PATH_PATTERN =
"schema.{json,yml}"
Class Method Summary collapse
-
.call(arguments) ⇒ Plz::Command, Plz::ErrorCommand
Builds callable command object from given ARGV.
Instance Method Summary collapse
-
#call ⇒ Plz::Command
Callable command object.
-
#initialize(argv) ⇒ CommandBuilder
constructor
A new instance of CommandBuilder.
Constructor Details
#initialize(argv) ⇒ CommandBuilder
Returns a new instance of CommandBuilder.
23 24 25 |
# File 'lib/plz/command_builder.rb', line 23 def initialize(argv) @argv = argv end |
Class Method Details
.call(arguments) ⇒ Plz::Command, Plz::ErrorCommand
Note:
This is a shortcut for #call method
Builds callable command object from given ARGV
10 11 12 |
# File 'lib/plz/command_builder.rb', line 10 def self.call(arguments) new(arguments).call end |
Instance Method Details
#call ⇒ Plz::Command
Returns Callable command object.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/plz/command_builder.rb', line 28 def call exit_if_help validate! Command.new( method: method, base_url: base_url, path: path, headers: headers, params: request_params, options: , ) rescue Error => error ErrorCommand.new(error) end |