require 'tempfile'out = Tempfile.new("tempfile")out.path out << "Some text."out.rewindout.read out.close