Serialization.rb
# ⢀⡴⠊⢉⡟⢿ IRB v1.18.0 - Ruby 4.0.3
# ⣎⣀⣴⡋⡟⣻ "debug" to start integration with the "debug" gem
# ⣟⣼⣱⣽⣟⣾ ~/work/YS124/YS124
person = { name: "Alice", age: 30 }
#=> {name: "Alice", age: 30}
serialized_person = Marshal.dump(person)
#=> "\x04\b{\a:\tnameI\"\nAlice\x06:\x06ET:\bagei#"
File.open('input/serialization/person.dat', 'wb') do |file|
file.write(serialized_person)
end
#=> 30
Ruby 4.0.3