Module: RubyGPG2::Commands::Mixins::WithCapturedStatus

Included in:
GenerateKey, Import
Defined in:
lib/ruby_gpg2/commands/mixins/with_captured_status.rb

Instance Method Summary collapse

Instance Method Details

#do_after(opts) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/ruby_gpg2/commands/mixins/with_captured_status.rb', line 22

def do_after(opts)
  if opts[:with_status]
    super(opts.merge(status: resolve_status(@status, opts)))
  else
    super(opts)
  end
end

#do_around(opts) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby_gpg2/commands/mixins/with_captured_status.rb', line 11

def do_around(opts)
  if opts[:with_status]
    Tempfile.create('status-file', opts[:work_directory]) do |f|
      yield opts.merge(status_file: f.path)
      @status = File.read(f.path)
    end
  else
    yield opts
  end
end