Class: RubyGPG2::Commands::Base

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

Instance Method Summary collapse

Constructor Details

#initialize(binary: nil, stdin: nil, stdout: nil, stderr: nil) ⇒ Base

Returns a new instance of Base.



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

def initialize(binary: nil, stdin: nil, stdout: nil, stderr: nil)
  @binary = binary || RubyGPG2.configuration.binary
  @stdin = stdin || RubyGPG2.configuration.stdin
  @stdout = stdout || RubyGPG2.configuration.stdout
  @stderr = stderr || RubyGPG2.configuration.stderr
end

Instance Method Details

#execute(opts = {}) ⇒ Object



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

def execute(opts = {})
  do_before(opts)
  do_around(opts) do |updated_opts|
    builder = configure_command(instantiate_builder, updated_opts)
    builder
      .build
      .execute(stdin: stdin, stdout: stdout, stderr: stderr)
  end
  do_after(opts)
end