Robert Klemme
1/25/2006 10:30:00 AM
Erik Veenstra wrote:
> If you do an inspect on a collection of Ruby objects, like a
> hash, you end up with a string. It's possible to store this
> string in a file, read it again somewhere in the future,
> evaluate it and end up with the same collection of Ruby objects
> in core.
>
> So I've written this String#de_inspect, which uses
> Kernel#suspicious (slow!) to avoid any malicious code from
> being evaluated.
>
> A kind of human-readable marshaling. That is-human-readable is
> important, for me, in this situation.
>
> (You can only dump objects which inspect to Ruby code, e.g.
> Strings, Numerics, Symbols, Arrays, Hashes, nil, true and
> false.)
>
> I've attached the code and an example, though the example isn't
> important.
>
> Thoughts? Comments?
A question: what is the advantage of this over YAML?
Kind regards
robert