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?  This would allow me to do
> things like
> 
>     input = <<END
> example input for my class
> More of the same
> other stuff
> ..etc
> END
>     <something here>
>     while input_as_file.gets
>         ...
>     end
> 
> within my unit tests, which would keep all the input with the 
> tests.

Depending on your circumstances, you could change your code to read the 
file using #each, which works for both strings and files.

     input_as_file.each do |line|
          ...
     end



Regards


Dave