Class: Enruby::Command::Base
- Inherits:
-
Object
- Object
- Enruby::Command::Base
- Defined in:
- lib/enruby/command/base.rb
Instance Method Summary collapse
-
#execute(parameters = {}, invocation_options = {}) ⇒ Object
Executes the command instance.
-
#initialize(opts = {}) ⇒ Base
constructor
rubocop:disable Metrics/AbcSize.
Constructor Details
#initialize(opts = {}) ⇒ Base
rubocop:disable Metrics/AbcSize
11 12 13 14 15 16 17 18 |
# File 'lib/enruby/command/base.rb', line 11 def initialize(opts = {}) @binary = opts[:binary] || configuration.binary @logger = opts[:logger] || configuration.logger @options = opts[:options] || configuration. @stdin = opts[:stdin] || configuration.stdin @stdout = opts[:stdout] || configuration.stdout @stderr = opts[:stderr] || configuration.stderr end |
Instance Method Details
#execute(parameters = {}, invocation_options = {}) ⇒ Object
Executes the command instance.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/enruby/command/base.rb', line 31 def execute(parameters = {}, = {}) parameters = resolve_parameters(parameters) = () do_before(parameters) result = build_and_execute_command(parameters, ) do_after(parameters) prepare_result(result, parameters, ) rescue Lino::Errors::ExecutionError = "Failed while running '#{command_name}'." logger.error() raise Errors::ExecutionError, end |