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-1.4.0-x86_64-linux-gnu spec/support/console_helper.rb
expressir-1.4.0-x86_64-darwin spec/support/console_helper.rb
expressir-1.4.0-x64-mingw32 spec/support/console_helper.rb
expressir-1.4.0-x64-mingw-ucrt spec/support/console_helper.rb
expressir-1.4.0-arm64-darwin spec/support/console_helper.rb
expressir-1.4.0-aarch64-linux-musl spec/support/console_helper.rb
expressir-1.4.0-aarch64-linux-gnu spec/support/console_helper.rb
expressir-1.3.3 spec/support/console_helper.rb
expressir-1.3.3-x86_64-linux-musl spec/support/console_helper.rb
expressir-1.3.3-x86_64-linux-gnu spec/support/console_helper.rb
expressir-1.3.3-x86_64-darwin spec/support/console_helper.rb
expressir-1.3.3-x64-mingw32 spec/support/console_helper.rb
expressir-1.3.3-x64-mingw-ucrt spec/support/console_helper.rb
expressir-1.3.3-arm64-darwin spec/support/console_helper.rb
expressir-1.3.3-aarch64-linux-musl spec/support/console_helper.rb
expressir-1.3.3-aarch64-linux-gnu spec/support/console_helper.rb
expressir-1.3.2 spec/support/console_helper.rb
expressir-1.3.2-x86_64-linux-gnu spec/support/console_helper.rb
expressir-1.3.2-x86_64-darwin spec/support/console_helper.rb
expressir-1.3.2-x64-mingw32 spec/support/console_helper.rb