Class: Gem::SilentUI

Inherits:
StreamUI show all
Defined in:
lib/rubygems/user_interaction.rb

Overview

SilentUI is a UI choice that is absolutely silent.

Instance Attribute Summary

Attributes inherited from StreamUI

#errs, #ins, #outs

Instance Method Summary collapse

Methods inherited from StreamUI

#alert, #alert_error, #alert_warning, #ask, #ask_for_password, #ask_for_password_on_unix, #ask_for_password_on_windows, #ask_yes_no, #backtrace, #choose_from_list, #debug, #say, #terminate_interaction, #tty?

Constructor Details

#initializeSilentUI

Returns a new instance of SilentUI.



550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/rubygems/user_interaction.rb', line 550

def initialize
  reader, writer = nil, nil

  begin
    reader = File.open('/dev/null', 'r')
    writer = File.open('/dev/null', 'w')
  rescue Errno::ENOENT
    reader = File.open('nul', 'r')
    writer = File.open('nul', 'w')
  end

  super reader, writer, writer, false
end

Instance Method Details

#download_reporter(*args) ⇒ Object



564
565
566
# File 'lib/rubygems/user_interaction.rb', line 564

def download_reporter(*args)
  SilentDownloadReporter.new(@outs, *args)
end

#progress_reporter(*args) ⇒ Object



568
569
570
# File 'lib/rubygems/user_interaction.rb', line 568

def progress_reporter(*args)
  SilentProgressReporter.new(@outs, *args)
end