GDBM plus classes other than String

D

David A. Black

Hi --

As an offshoot of some playing around with ActiveModel (part of Rails
3) and adding non-relational database backends to Rails, I've spawned
a little project called GDBMP, which lets you use non-string keys and
values in GDBM files.

I literally don't remember why I chose to add "P".

Anyway, it lets you do things like:

g = GDBMP.new("/tmp/myfile.gdbmp")
g[123] = :abc
g[:def] = 12.3

etc. The way it works is to store class names along with keys and
values, and then perform conversions on the way out.

It's pretty much hard-wired to a handful of classes, and pretty
simple-minded about the conversions, though you can also constrain
keys to have their values be of certain classes:

g.constrain_key:)year, Fixnum)
g[:year] = "1999"
g[:year] # 1999 (the integer)


You can find it on github:

http://github.com/dblack/gdbmp


David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,167
Messages
2,570,913
Members
47,455
Latest member
Delilah Code

Latest Threads

Top