Fwd: Re: [rug-b] Recap onPStore: Slides, Links and a Gist

3 views
Skip to first unread message

Tobias Pfeiffer

unread,
Aug 28, 2014, 6:21:55 AM8/28/14
to ru...@googlegroups.com
Another one that got stuck...


-------- Original Message --------
Subject: Re: [rug-b] Recap onPStore: Slides, Links and a Gist
Date: Fri, 8 Aug 2014 15:14:13 +0200
From: Tilmann Singer <ti...@tils.net>
To: Enrico Thierbach <e...@open-lab.org>, <ru...@googlegroups.com>



Thanks for the great talks!

Enrico Thierbach <e...@open-lab.org> writes:
>> * Don’t necessarily use the default Marshal storage format, it might
>> be incompatible between different Ruby versions
>
> and, I might add, not compatible to anything on the outside
> world. That’s why I love your JSON PStore :)

I'd like to add one more thing: IMHO the greatest value of PStore and
YAML::Store comes from their ability to restore object graphs of real
ruby classes, both standard and custom ones, so you don't need to deal
with manually re-instantiating your objects when restoring:

require 'yaml/store'
store = YAML::Store.new('store.yaml')
store.transaction { store['times'] = [Time.now] }
restored = store.transaction { store['times'] }

p restored #=> [2014-08-08 15:07:28 +0200]
p restored.first.class #=> Time


YAML::Store provides human readability and better compatibility, but can
be slower than PStore.


Til



Attached Message Part
Reply all
Reply to author
Forward
0 new messages