This Gem::StreamUI
subclass records input and output to StringIO
for retrieval during tests.
# File ruby-3.1.2/lib/rubygems/mock_gem_ui.rb, line 42 def initialize(input = "") require 'stringio' 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
# File ruby-3.1.2/lib/rubygems/mock_gem_ui.rb, line 57 def ask(question) raise InputEOFError, question if @ins.eof? super end
# File ruby-3.1.2/lib/rubygems/mock_gem_ui.rb, line 71 def error @errs.string end
# File ruby-3.1.2/lib/rubygems/mock_gem_ui.rb, line 63 def input @ins.string end
# File ruby-3.1.2/lib/rubygems/mock_gem_ui.rb, line 67 def output @outs.string end