[LRUG] Serialising a struct

Matt Spendlove matt at cenatus.org
Mon Apr 14 07:41:16 PDT 2014


I'm not sure why replaying responses via VCR doesn't help you but assuming
you don't want to do that, the simplest thing you can do is just new up
some Structs that mirror the data. Are the responses really that verbose?

  --
*Matt Spendlove - Cenatus*
458 Hackney Road, London E2 9EG
+44 (0)7976 609379
http://cenatus.org
http://netaudiolondon.org



On Mon, Apr 14, 2014 at 3:27 PM, Paul Battley <pbattley at gmail.com> wrote:

> 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.
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140414/59e670cf/attachment-0003.html>


More information about the Chat mailing list