Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more

In Files

  • rubygems/mock_gem_ui.rb

Class/Module Index [+]

Quicksearch

Gem::MockGemUi

This Gem::StreamUI subclass records input and output to StringIO for retrieval during tests.

Public Class Methods

new(input = "") click to toggle source
 
               # File rubygems/mock_gem_ui.rb, line 33
def initialize(input = "")
  ins = StringIO.new input
  outs = StringIO.new
  errs = StringIO.new

  ins.extend TTY
  outs.extend TTY
  errs.extend TTY

  super ins, outs, errs, true

  @terminated = false
end
            

Public Instance Methods

error() click to toggle source
 
               # File rubygems/mock_gem_ui.rb, line 55
def error
  @errs.string
end
            
input() click to toggle source
 
               # File rubygems/mock_gem_ui.rb, line 47
def input
  @ins.string
end
            
output() click to toggle source
 
               # File rubygems/mock_gem_ui.rb, line 51
def output
  @outs.string
end
            
terminate_interaction(status=0) click to toggle source
 
               # File rubygems/mock_gem_ui.rb, line 63
def terminate_interaction(status=0)
  @terminated = true

  raise TermError, status if status != 0
  raise SystemExitException
end
            
terminated?() click to toggle source
 
               # File rubygems/mock_gem_ui.rb, line 59
def terminated?
  @terminated
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.