Sha256: dae4666a1a88e7d3fe8b4c33575fa90036d8eb4125efa77b336a628ac6e27468

Contents?: true

Size: 650 Bytes

Versions: 5

Compression:

Stored size: 650 Bytes

Contents

require 'tempfile'

require_relative '../../status_output'

module RubyGPG2
  module Commands
    module Mixins
      module WithCapturedStatus
        def do_around(opts)
          if opts[:with_status]
            Tempfile.create do |f|
              yield opts.merge(status_file: f.path)
              @status = File.read(f.path)
            end
          else
            yield opts
          end
        end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby_gpg2-0.1.0.pre.19 lib/ruby_gpg2/commands/mixins/with_captured_status.rb
ruby_gpg2-0.1.0.pre.18 lib/ruby_gpg2/commands/mixins/with_captured_status.rb
ruby_gpg2-0.1.0.pre.17 lib/ruby_gpg2/commands/mixins/with_captured_status.rb
ruby_gpg2-0.1.0.pre.16 lib/ruby_gpg2/commands/mixins/with_captured_status.rb
ruby_gpg2-0.1.0.pre.15 lib/ruby_gpg2/commands/mixins/with_captured_status.rb