title: How do I write to a file in Ruby?
body: <p>There are many SO answers for this such as "<a href="https://stackoverflow.com/questions/2777802/how-to-write-to-file-in-ruby">How to write to file in Ruby?</a>", but I am missing a point with a <code>path to file</code>:</p>
  
  <p>I have a file structure like this: </p>
  
  <pre><code>├── test.txt
  ├── write_to_file.rb
  </code></pre>
  
  <p>and "write_to_file.rb" has the following content: </p>
  
  <pre><code> File.open('test.txt', 'w') { |file| file.write('hello') }
   # tried ('./test.txt','w') ..as well.
  </code></pre>
  
  <p>How do I write some content to <code>test.txt</code> file from another <code>write_to_file.rb</code>? </p>