On Thu, 25 Sep 2008, peter retief wrote:

> What is the suggested means to add data persistence to shoes?
> 
> I thought that yaml would be a good start
> 
> reading:
> data = open("data.yml").readlines

Use YAML::Load or YAML::loadfile for this.
> writing:
> open('datafile.yml', 'w'){|f| f.puts YAML.dump(data)}
> 

That's about right.
> Any advice? Pointers? Treasure maps?

Depends what you want to use it for, really.  If you are talking
to things outside of Ruby/Perl/Python then you may want to use
coma separated values, and you may need to compress the data for 
other applications.  There are times when XML is appropriate,
The only problem I foresee with YAML, which so far hasn't been a
problem, is that it relies of whitespace for its structure.  But
apart from that it'll do for most apps.

> 
> Something simple
> 
It's easy to work with in your program, and it is pretty readable.

        Hugh

Reply via email to