Skip to content

Instantly share code, notes, and snippets.

@rex
Created February 13, 2015 23:39
Show Gist options
  • Select an option

  • Save rex/affd2bac6e4c0233776f to your computer and use it in GitHub Desktop.

Select an option

Save rex/affd2bac6e4c0233776f to your computer and use it in GitHub Desktop.
Easily implement basic file operations in Ruby
# One-liner to write data to a file
File.open(yourfile, 'w') { |file| file.write("your text") }
# And reading is even simpler
File.read(yourfile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment