Skip to content

Instantly share code, notes, and snippets.

@mmcdaris
Created February 1, 2017 01:57
Show Gist options
  • Save mmcdaris/89e7b561831a06bd14b60be3dfc17248 to your computer and use it in GitHub Desktop.
Save mmcdaris/89e7b561831a06bd14b60be3dfc17248 to your computer and use it in GitHub Desktop.
Dump to a file! Move some objs
# Fancy obj you want to share
hash = {
a: 1234,
b: %W(this that the other one man yo yoy oyoyoyo),
c: "Magic Pants Found!"
}
# dump and write to file
File.open("marsha_marsha_marsha", 'wb') { |f| f.write(Marshal.dump(hash)) }
# read file and load back to object
hash_from_file = Marshal.load(File.read("marsha_marsha_marsha"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment