Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Primitive JSON data store

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .jrubyrc
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 abbey.gemspec
README.md

Abbey

A primitive JSON data store

Description

A simple persistence library with human-readable representation. Uses good 'ol filesystem. Features: basic operations & namespaces. To be used for prototyping and as a backend of more sophisticated/specific implementations.

Usage

Warning: Abbey intentionally uses JSON, therefore it inherits it's caveats. Most notably, symbols are serialized to strings.

require 'abbey'

abbey = Abbey::EntityStorage.new(Abbey::Settings.new('/var/myapp/data', [:users, :books]))

abbey.set_up! unless abbey.set_up? # will prepare directories and shit

abbey.save(:users, :admin, {:name => "John Smith"})

abbey.save(:users, :admin, {:name => "John Smith"}) # => Abbey::ItemAlreadyExistsError

abbey.get(:users, :admin) # => {"name" => "John Smith"}

abbey.update(:users, :admin, {:name => "John C. Smith"})

abbey.update(:users, :nonexistent, {:name => "Joe Black"}) # => Abbey::ItemNotFoundError

abbey.list(:users) # => #<Set: {:admin}>

abbey.get_all(:users) # => {"admin" => {"name" => "John Smith"}}

abbey.delete(:users, :admin)

abbey.drop(:users) # will delete all data in the namespace

abbey.exists?(:users, :admin) # => false

abbey.settings.namespaces # => [:users, :books]

abbey.settings.logger # => #<Logger....>

License

MIT. See LICENSE.txt

Author

Pavel Kalvoda me@pavelkalvoda.com

Something went wrong with that request. Please try again.