123456789_123456789_123456789_123456789_123456789_

Class: Gem::SilentUI

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, StreamUI
Instance Chain:
self, StreamUI
Inherits: Gem::StreamUI
Defined in: lib/rubygems/user_interaction.rb

Overview

SilentUI is a UI choice that is absolutely silent.

Class Method Summary

  • .new ⇒ SilentUI constructor

    The SilentUI has no arguments as it does not use any stream.

StreamUI - Inherited

.new

Creates a new StreamUI wrapping in_stream for user input, out_stream for standard output, err_stream for error output.

Instance Attribute Summary

StreamUI - Inherited

#errs

The error stream.

#ins

The input stream.

#outs

The output stream.

#tty?

Returns true if TTY methods should be used on this StreamUI.

Instance Method Summary

StreamUI - Inherited

#_gets_noecho

See additional method definition at line 316.

#alert

Display an informational alert.

#alert_error

Display an error message in a location expected to get error messages.

#alert_warning

Display a warning on stderr.

#ask

Ask a question.

#ask_for_password

Ask for a password.

#ask_yes_no

Ask a question.

#backtrace

Prints a formatted backtrace to the errors stream if backtraces are enabled.

#choose_from_list

Choose from a list of options.

#close,
#debug

Display a debug message on the same location as error messages.

#download_reporter

Return a download reporter object chosen from the current verbosity.

#progress_reporter

Return a progress reporter object chosen from the current verbosity.

#say

Display a statement.

#terminate_interaction

Terminate the application with exit code status, running any exit handlers that might have been defined.

Constructor Details

.newSilentUI

The SilentUI has no arguments as it does not use any stream.

[ GitHub ]

  
# File 'lib/rubygems/user_interaction.rb', line 676

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

#close

[ GitHub ]

  
# File 'lib/rubygems/user_interaction.rb', line 690

def close
  super
  @ins.close
  @outs.close
end