Write file from string in Ruby

Tagged with Ruby

Language: Ruby

View as text

# write the file from a string
def put_file_from_string(f, s)
  File.open(f , 'w') do |file|
      file.puts(s)
  end
end
Last updated at 06:37 AM on Aug 08, 2008 by Brian Hogan

SnippetStash costs money to host and develop. The service is free for everyone to use
but if you found it useful please consider making a small donation.