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.



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

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



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

def execute(opts = {})
  builder = instantiate_builder

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