Is it possible to convert a string to a file without writing it to disk?

I would like to work ubiquitously with either a string of a file:

input = "123"
if (ARGV.length == 1)
   input = File.open(ARGV[0])

   #do stuff with input
end

Can I create a file from a string (without writing to disk)? Otherwise, I would not be able to do input.readline() when it's a string.

Edit
Report