Class: RubyVault::Commands::Base
- Inherits:
-
Object
- Object
- RubyVault::Commands::Base
- Defined in:
- lib/ruby_vault/commands/base.rb
Instance Method Summary collapse
-
#execute(parameters = {}, invocation_options = {}) ⇒ Object
Executes the command instance.
-
#initialize(**opts) ⇒ Base
constructor
Constructs an instance of the command.
Constructor Details
#initialize(**opts) ⇒ Base
Constructs an instance of the command.
14 15 16 17 18 19 20 21 |
# File 'lib/ruby_vault/commands/base.rb', line 14 def initialize(**opts) @binary = opts[:binary] || RubyVault.configuration.binary @logger = opts[:logger] || RubyVault.configuration.logger @options = opts[:options] || RubyVault.configuration. @stdin = opts[:stdin] || RubyVault.configuration.stdin @stdout = opts[:stdout] || RubyVault.configuration.stdout @stderr = opts[:stderr] || RubyVault.configuration.stderr end |
Instance Method Details
#execute(parameters = {}, invocation_options = {}) ⇒ Object
Executes the command instance.
34 35 36 37 38 39 40 41 42 |
# File 'lib/ruby_vault/commands/base.rb', line 34 def execute(parameters = {}, = {}) do_before(parameters) build_and_execute_command(parameters, ) do_after(parameters) rescue Open4::SpawnError = "Failed while running '#{command_name}'." logger.error() raise Errors::ExecutionError, end |