0.0
No release in over 3 years
Low commit activity in last 3 years
Store objects in a file using hash-like syntax
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.0
 Project Readme

Hash Cabinet - File based key-object store

Gem Version Build Status Maintainability


Hash Cabinet is a file-based, key-object store with hash-like access.

Highlights

  • Tiny library, based on Ruby's built in SDBM.
  • Stores simple values or complex objects through transparent YAML serialization.
  • Easy hash-like access: cabinet['key'] = 'value'.
  • Mirrors most of the native SDBM methods.

Installation

$ gem install hash_cabinet

Usage

require 'hash_cabinet'

cabinet = HashCabinet.new 'dbfile'

# Store values
cabinet['some-key'] = 'some-value'
cabinet['another-key'] = { color: 'yellow' }

# Retrieve values
p cabinet['another-key']
#=> {:color=>"yellow"}

# Show all values
p cabinet.to_h
#=> {"some-key"=>"some=value", "another-key"=>{:color=>"yellow"}}

Documentation

Related Projects

For an ActiveRecord-like interface for Hash Cabinet, see ActiveCabinet.

Contributing / Support

If you experience any issue, have a question or a suggestion, or if you wish to contribute, feel free to open an issue.