Sha256: 659a0b470938fed05a91a3f5fe551f5ba1a482bedcc78228d10898f7cc96982d

Contents?: true

Size: 693 Bytes

Versions: 31

Compression:

Stored size: 693 Bytes

Contents

# frozen_string_literal: true

require 'stringio'

module Reek
  module CLI
    # CLI silencer
    module Silencer
      module_function

      # @quality :reek:TooManyStatements { max_statements: 9 }
      def silently
        old_verbose = $VERBOSE
        old_stderr = $stderr
        old_stdout = $stdout

        $VERBOSE = false
        $stderr = StringIO.new
        $stdout = StringIO.new
        yield
      ensure
        $VERBOSE = old_verbose
        $stderr = old_stderr
        $stdout = old_stdout
      end

      def without_warnings
        old_verbose = $VERBOSE
        $VERBOSE = false
        yield
      ensure
        $VERBOSE = old_verbose
      end
    end
  end
end

Version data entries

31 entries across 29 versions & 2 rubygems

Version Path
reek-6.4.0 lib/reek/cli/silencer.rb
reek-6.3.0 lib/reek/cli/silencer.rb
reek-6.2.0 lib/reek/cli/silencer.rb
reek-6.1.4 lib/reek/cli/silencer.rb
reek-6.1.3 lib/reek/cli/silencer.rb
reek-6.1.2 lib/reek/cli/silencer.rb
reek-6.1.1 lib/reek/cli/silencer.rb
reek-6.1.0 lib/reek/cli/silencer.rb
reek-6.0.6 lib/reek/cli/silencer.rb
reek-6.0.5 lib/reek/cli/silencer.rb
reek-6.0.4 lib/reek/cli/silencer.rb
reek-6.0.3 lib/reek/cli/silencer.rb
reek-6.0.2 lib/reek/cli/silencer.rb
reek-6.0.1 lib/reek/cli/silencer.rb
reek-6.0.0 lib/reek/cli/silencer.rb
reek-5.6.0 lib/reek/cli/silencer.rb
reek-5.5.0 lib/reek/cli/silencer.rb
reek-5.4.1 lib/reek/cli/silencer.rb
reek-5.4.0 lib/reek/cli/silencer.rb
reek-5.3.2 lib/reek/cli/silencer.rb