Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

abbey

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abbey


Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 08 Dec 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc