The built-in Marshal class is designed for this very thing, and
anecdotal evidence says it's faster than YAML. YAML has the advantage
of being readable to the naked eye, however. Here's a good discussion
on Marshal vs. YAML:

http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/99119?99004-101444


On 10/25/06, guoxianghao / gmail.com <guoxianghao / gmail.com> wrote:
> Use YAML you can store/load the content of a Ruby object without any
> difficulty.
>
> Please visit YAML.rb at http://yaml4r.sourceforge.net/
> The codebook is of great use to give you what is going on:
> http://yaml4r.sourceforge.net/cookbook/
>
> Steve Quezadas wrote:
> > Is there an easy way to save the contents of an object in ruby?
> >
> > This is hard to google, so I am posting it up. I just need a general
> > idea (if anyoen has it), you don't have to spell it out for me.
> >
> > --
> > Posted via http://www.ruby-forum.com/.
>
>
>