Class TempIO
In: lib/rubygems/test_utilities.rb
Parent: Object

A StringIO duck-typed class that uses Tempfile instead of String as the backing store.

Methods

Public Class methods

[Source]

     # File lib/rubygems/test_utilities.rb, line 98
 98:   def initialize(string = '')
 99:     @tempfile = Tempfile.new "TempIO-#{@@count += 1}"
100:     @tempfile.binmode
101:     @tempfile.write string
102:     @tempfile.rewind
103:   end

Public Instance methods

[Source]

     # File lib/rubygems/test_utilities.rb, line 105
105:   def method_missing(meth, *args, &block)
106:     @tempfile.send(meth, *args, &block)
107:   end

[Source]

     # File lib/rubygems/test_utilities.rb, line 109
109:   def respond_to?(meth)
110:     @tempfile.respond_to? meth
111:   end

[Source]

     # File lib/rubygems/test_utilities.rb, line 113
113:   def string
114:     @tempfile.flush
115: 
116:     Gem.read_binary @tempfile.path
117:   end

[Validate]