Module: Komando::Command
- Defined in:
- lib/komando/command.rb,
lib/komando/command/dsl.rb
Defined Under Namespace
Modules: Dsl
Class Method Summary collapse
-
.run!(instance_variable_declarations) ⇒ true
Instantiates and runs this command.
Instance Method Summary collapse
-
#initialize(instance_variable_declarations = {}) ⇒ Object
The instance variables will be available in the blocks, courtesy of Ruby and it’s dynamic nature.
-
#logger ⇒ #warn, ...
Returns a Logger-like object that will log receive #warn, #info and #debug calls.
-
#run! ⇒ true
Executes the mandatory and best effort steps, in order of definition, raising or logging and swallowing exceptions as appropriate.
Class Method Details
.run!(instance_variable_declarations) ⇒ true
Instantiates and runs this command.
10 11 12 |
# File 'lib/komando/command.rb', line 10 def self.run!(instance_variable_declarations) new.run!(instance_variable_declarations) end |
Instance Method Details
#initialize(instance_variable_declarations = {}) ⇒ Object
The instance variables will be available in the blocks, courtesy of Ruby and it’s dynamic nature.
17 18 19 20 21 |
# File 'lib/komando/command.rb', line 17 def initialize(instance_variable_declarations={}) instance_variable_declarations.each do |name, value| instance_variable_set("@#{name}", value) end end |
#logger ⇒ #warn, ...
Returns a Logger-like object that will log receive #warn, #info and #debug calls. The logger can do whatever it wants with those calls.
49 50 51 |
# File 'lib/komando/command.rb', line 49 def logger @logger ||= Logger.new(STDERR) end |
#run! ⇒ true
Executes the mandatory and best effort steps, in order of definition, raising or logging and swallowing exceptions as appropriate.
28 29 30 31 32 |
# File 'lib/komando/command.rb', line 28 def run! run_mandatory! run_best_effort true end |