--8323328-1407291743-10957146278837
Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1407291743-1095714627=:18837"

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-1407291743-10957146278837
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Tue, 21 Sep 2004, Bill Kelly wrote:

> From: "trans. (T. Onoma)" <transami / runbox.com>
>> On Monday 20 September 2004 04:14 pm, Kristian Sørensen wrote:
>>> Thanks for both your suggestions! That was just what I needed! :-)
>>
>> There's also YAML.
> [...]
>> Nice thing about YAML is that the file it creates is human readable and
>> editable!
>
> Additionally YAML supports a drop-in PStore equivalent, so if your code
> is already structured to use PStore, you can a YAML::Store the same way.
>
> require 'yaml/store'
>
> ystore = YAML::Store.new("my_datafile.ystore")
>
> # use ystore just as you would a pstore:
>
> my_hash = {"a"=>1, "b"=>2}
> my_array = %w(dog cat elephant)
>
> # store stuff in the database
>
> ystore.transaction do
>  ystore["my_hash"] = my_hash
>  ystore["my_array"] = my_array
> end
>
> # print out all keys/values in database
>
> ystore.transaction do
>  ystore.roots.each do |key|
>    puts ystore[key].inspect
>  end
> end
>
>
> # note the above code is untested

yes - yaml is very, very cool - i use it alot for my own code.  a couple of
things to be aware of

   - yaml is alot slower than marshal.  if your db has only 10,000 entries or
     so this no problem

   - flock does not work on nfs filesystems (used by pstore an
     yaml::store)

-a
--
===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it. 
|   --Dogen
===============================================================================
--8323328-1407291743-10957146278837--
--8323328-1407291743-10957146278837--