title: Ruby writing to a file in memory (not actually writing to it)
body: <p>So I have this program that works with passing around a string (this string is the path of the file it is supposed to read)</p>
  
  <p>Now I have a method that has to open that file. change the text with Gsub and than output that file again (The original file can't be edited) but I need to eventually output that changed file </p>
  
  <p>this is the method i'm using to change my file (simplified)</p>
  
  <pre><code>def self.changeFile(myfile)
  myfile = @path
  
  doc = File.open(myfile)
  text = doc.read
  
  text.gsub!("change" , "changed")
  
  return text
  </code></pre>
  
  <p>the problem with this is I get the entire file as string returned. My other methods work with the input of a "string" pathname </p>
  
  <p>So my question is is there anyway I can write my text to the file I changed in the memory, so without actually changing the original file? </p>
  
  <p>I was thinking about using "Tempfile" or "StringIO" but I don't know if this is the right thing to go about</p>
  
  <p>All Help is appreciated</p>