fast_open_struct
fast_open_struct copied to clipboard
Structs should be serializable
It would be very useful to be able to serialize fast open structs, since usual open structs allow this. For example, Marshal can be used with regular structs, but not with open ones.
$ irb
irb(main):001:0> require 'ostruct'
=> true
irb(main):002:0> Marshal.dump(OpenStruct.new)
=> "\x04\bU:\x0FOpenStruct{\x00"
irb(main):003:0> require 'fast_open_struct'
=> true
irb(main):004:0> Marshal.dump(FastOpenStruct.new)
TypeError: can't dump anonymous class #<Class:0x20055030>
from (irb):4:in `dump'
from (irb):4
from /usr/bin/irb:12:in `<main>'