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 138
138:   def initialize(string = '')
139:     @tempfile = Tempfile.new "TempIO-#{@@count += 1}"
140:     @tempfile.binmode
141:     @tempfile.write string
142:     @tempfile.rewind
143:   end

Public Instance methods

[Source]

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

[Source]

     # File lib/rubygems/test_utilities.rb, line 149
149:   def respond_to?(meth)
150:     @tempfile.respond_to? meth
151:   end

[Source]

     # File lib/rubygems/test_utilities.rb, line 153
153:   def string
154:     @tempfile.flush
155: 
156:     Gem.read_binary @tempfile.path
157:   end

[Validate]