Sha256: 319d127527d3f153079334b17d492327acc528a4cc7cd7e0e4c1f74b4d1c4927

Contents?: true

Size: 472 Bytes

Versions: 4

Compression:

Stored size: 472 Bytes

Contents

module Digicert
  module ConsoleHelper
    def capture_stdout(&_block)
      original_stdout = $stdout
      $stdout = fake = StringIO.new

      begin
        yield
      ensure
        $stdout = original_stdout
      end

      fake.string
    end

    def capture_stderr(&_block)
      original_stderr = $stderr
      $stderr = fake = StringIO.new

      begin
        yield
      ensure
        $stderr = original_stderr
      end

      fake.string
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
digicert-cli-1.0.0 spec/support/console_helper.rb
digicert-cli-0.5.2 spec/support/console_helper.rb
digicert-cli-0.5.1 spec/support/console_helper.rb
digicert-cli-0.5.0 spec/support/console_helper.rb