Sha256: f02bf2990133eac972c0be3212c2a2cf9bcf6bdb0edb2f7e84d9564974f18458

Contents?: true

Size: 445 Bytes

Versions: 2

Compression:

Stored size: 445 Bytes

Contents

require 'stringio'

module Reek
  module CLI
    # CLI silencer
    # @api private
    module Silencer
      module_function

      def silently(stderr: nil, stdout: nil)
        old_verbose = $VERBOSE
        $VERBOSE = false
        $stderr = StringIO.new if stderr
        $stdout = StringIO.new if stdout
        yield
      ensure
        $VERBOSE = old_verbose
        $stderr = STDERR
        $stdout = STDOUT
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reek-3.3.1 lib/reek/cli/silencer.rb
reek-3.3.0 lib/reek/cli/silencer.rb