deserialization.rb(serialization)
Using Marshal for Serialization
The Marshal provides a way to serialize Ruby objects into a binary format and then deserialize them back to Ruby objects.
Execution:
serialized_person = File.read('person.dat')
#=> "\u0004\b{\a:\tnameI\"\nAlice\u0006:\u0006ET:\bagei#"
Marshal.load(serialized_person)
#=> {:name=>"Alice", :age=>30}
Executed with Ruby 3.3.6