Hi,

In message "[ruby-talk:5335] string streams in Ruby?"
    on 00/10/10, Hugh Sasse Staff Elec Eng <hgs / dmu.ac.uk> writes:

|Is there any way, without going through "modifying the internals",
|to convert Strings to look like files?

It depends on how much your input string should look like a file.
Very close to complete but inefficient way is:

  require 'tempfile'
  f = Tempfile.new("input")
  f.print input
  f.rewind
  ... use f as input ...

If you require just 'gets', then easy and bit more efficient way is:

  def input.gets
    unless defined? @gets
       @gets = self.collect
    end
    gets.shift
  end

And "there're probably more than hundred ways to do it".

							matz.