One line Marshal
A lot of times you want to dump the entire dataset and work on it later. If you’re staying in the language, then you don’t need to worry about spoon feeding in a format that another language can understand.
Let’s welcome Ruby’s Marshal:
#dump (write to an IO) most objects :)
a = [1,2,2,3,4,5,2,[3,4,2,[“this is a nested array”]]
#write(w) array into a binary (b) file
File.open(“a.file”,“wb”) {|file| Marshal.dump(a,file)}
#read® array from a binary (b) file
File.open(“a.file”,“rb”) {|f| b = Marshal.load(f)}