Class: RubyGPG2::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_gpg2/commands/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
16
# File 'lib/ruby_gpg2/commands/base.rb', line 11

def initialize(opts = {})
  @binary = opts[:binary] || RubyGPG2.configuration.binary
  @stdin = opts[:stdin] || RubyGPG2.configuration.stdin
  @stdout = opts[:stdout] || RubyGPG2.configuration.stdout
  @stderr = opts[:stderr] || RubyGPG2.configuration.stderr
end

Instance Method Details

#execute(parameters = {}, invocation_options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ruby_gpg2/commands/base.rb', line 18

def execute(parameters = {}, invocation_options = {})
  parameters = resolve_parameters(parameters)
  invocation_options = resolve_invocation_options(invocation_options)

  do_before(parameters, invocation_options)
  result = do_around(parameters, invocation_options) do |p, io|
    build_and_execute_command(p, io)
  end
  result = do_after(result, parameters, invocation_options)
  prepare_result(result, parameters, invocation_options)
end