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 109
109:   def initialize(string = '')
110:     @tempfile = Tempfile.new "TempIO-#{@@count += 1}"
111:     @tempfile.binmode
112:     @tempfile.write string
113:     @tempfile.rewind
114:   end

Public Instance methods

[Source]

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

[Source]

     # File lib/rubygems/test_utilities.rb, line 120
120:   def respond_to?(meth)
121:     @tempfile.respond_to? meth
122:   end

[Source]

     # File lib/rubygems/test_utilities.rb, line 124
124:   def string
125:     @tempfile.flush
126: 
127:     Gem.read_binary @tempfile.path
128:   end

[Validate]