From: "David A. Black" Date: 2009-09-23T21:37:34+09:00 Subject: GDBM plus classes other than String 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 -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentoring, code review Book: The Well-Grounded Rubyist (http://www.manning.com/black2)