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.15-x86_64-linux spec/support/console_helper.rb
expressir-0.2.15-x86_64-darwin spec/support/console_helper.rb
expressir-0.2.15-x86-mingw32 spec/support/console_helper.rb
expressir-0.2.15-x86-linux spec/support/console_helper.rb
expressir-0.2.15-x64-mingw32 spec/support/console_helper.rb
expressir-0.2.15-arm64-darwin spec/support/console_helper.rb
expressir-0.2.14 spec/support/console_helper.rb
expressir-0.2.14-x86_64-linux spec/support/console_helper.rb
expressir-0.2.14-x86_64-darwin spec/support/console_helper.rb
expressir-0.2.14-x86-mingw32 spec/support/console_helper.rb
expressir-0.2.14-x86-linux spec/support/console_helper.rb
expressir-0.2.14-x64-mingw32 spec/support/console_helper.rb
expressir-0.2.14-arm64-darwin spec/support/console_helper.rb
expressir-0.2.13 spec/support/console_helper.rb
expressir-0.2.13-x86_64-linux spec/support/console_helper.rb
expressir-0.2.13-x86_64-darwin spec/support/console_helper.rb
expressir-0.2.13-x86-mingw32 spec/support/console_helper.rb
expressir-0.2.13-x86-linux spec/support/console_helper.rb
expressir-0.2.13-x64-mingw32 spec/support/console_helper.rb
expressir-0.2.13-arm64-darwin spec/support/console_helper.rb