Sha256: 97ab9ca8717c64d695bd82a065d89ea99850aac5f80164948375788c1985851a

Contents?: true

Size: 473 Bytes

Versions: 311

Compression:

Stored size: 473 Bytes

Contents

module Expressir
  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

311 entries across 311 versions & 1 rubygems

Version Path
expressir-0.2.7-x86_64-darwin spec/support/console_helper.rb
expressir-0.2.7-arm64-darwin spec/support/console_helper.rb
expressir-0.2.5-x86_64-linux spec/support/console_helper.rb
expressir-0.2.5-x86_64-darwin-19 spec/support/console_helper.rb
expressir-0.2.5 spec/support/console_helper.rb
expressir-0.2.4 spec/support/console_helper.rb
expressir-0.2.3 spec/support/console_helper.rb
expressir-0.2.2 spec/support/console_helper.rb
expressir-0.2.1 spec/support/console_helper.rb
expressir-0.2.0 spec/support/console_helper.rb
expressir-0.1.0 spec/support/console_helper.rb