Class: Gem::MockGemUi
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Exceptions:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
StreamUI
|
|
Instance Chain:
self,
StreamUI
|
|
Inherits: |
Gem::StreamUI
|
Defined in: | lib/rubygems/mock_gem_ui.rb |
Overview
This StreamUI subclass records input and output to StringIO for retrieval during tests.
Class Method Summary
- .new(input = "") ⇒ MockGemUi constructor
StreamUI - Inherited
Instance Attribute Summary
- #terminated? ⇒ Boolean readonly
StreamUI - Inherited
Instance Method Summary
StreamUI - Inherited
#_gets_noecho | See additional method definition at line 321. |
#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 |
Constructor Details
.new(input = "") ⇒ MockGemUi
Instance Attribute Details
#terminated? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rubygems/mock_gem_ui.rb', line 77
def terminated? @terminated end
Instance Method Details
#ask(question)
# File 'lib/rubygems/mock_gem_ui.rb', line 59
def ask question raise InputEOFError, question if @ins.eof? super end
#error
[ GitHub ]# File 'lib/rubygems/mock_gem_ui.rb', line 73
def error @errs.string end
#input
[ GitHub ]# File 'lib/rubygems/mock_gem_ui.rb', line 65
def input @ins.string end
#output
[ GitHub ]# File 'lib/rubygems/mock_gem_ui.rb', line 69
def output @outs.string end
#terminate_interaction(status = 0)
# File 'lib/rubygems/mock_gem_ui.rb', line 81
def terminate_interaction(status=0) @terminated = true raise TermError, status if status != 0 raise SystemExitException end