[LRUG] Serialising a struct

Paul Battley pbattley at gmail.com
Mon Apr 14 07:27:57 PDT 2014


On 14 April 2014 15:07, Stephen Nelson-Smith <sanelson at gmail.com> wrote:
> Marshal doesn't support dumping from a Struct

Marshal doesn't support dumping an anonymous class. Structs are fine
if they are assigned to a constant:

    [1] pry(main)> Foo = Struct.new(:bar)
    => Foo
    [2] pry(main)> Marshal.dump(Foo.new)
    => "\x04\bS:\bFoo\x06:\bbar0"

I don't know if that helps you. If the structs are defined by the AWS
library, perhaps not.

Paul.



More information about the Chat mailing list