Sha256: 195c8e64ecd53a36fdb907595c38c86c86151457cecbdaa7ff005f17827ec34c

Contents?: true

Size: 362 Bytes

Versions: 16

Compression:

Stored size: 362 Bytes

Contents

module Excavate
  module Utils
    module_function

    def silence_stream(stream)
      old_stream = stream.dup
      stream.reopen(RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ ? "NUL:" : "/dev/null") # rubocop:disable Performance/RegexpMatch, Metrics/LineLength
      stream.sync = true
      yield
    ensure
      stream.reopen(old_stream)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
excavate-0.3.7 lib/excavate/utils.rb
excavate-0.3.6 lib/excavate/utils.rb
excavate-0.3.5 lib/excavate/utils.rb
excavate-0.3.4 lib/excavate/utils.rb
excavate-0.3.3 lib/excavate/utils.rb
excavate-0.3.2 lib/excavate/utils.rb
excavate-0.3.1 lib/excavate/utils.rb
excavate-0.3.0 lib/excavate/utils.rb
excavate-0.2.5 lib/excavate/utils.rb
excavate-0.2.4 lib/excavate/utils.rb
excavate-0.2.3 lib/excavate/utils.rb
excavate-0.2.2 lib/excavate/utils.rb
excavate-0.2.1 lib/excavate/utils.rb
excavate-0.2.0 lib/excavate/utils.rb
excavate-0.1.1 lib/excavate/utils.rb
excavate-0.1.0 lib/excavate/utils.rb