Popularity
0.2
Stable
Activity
3.3
-
1
1
0

Monthly Downloads: 44
Programming language: Ruby
License: MIT License
Tags: Data Persistence     File Based     YAML    
Latest version: v1.0.0

QuickStore alternatives and similar gems

Based on the "ORM/ODM" category

Do you think we are missing an alternative of QuickStore or a related project?

Add another 'ORM/ODM' Gem

README

QuickStore

Gem Version Travis Build

Simple local key-value store based on YAML::Store.

Installation

Add this line to your application's Gemfile:

gem 'quick_store'

And then execute:

$ bundle

Or install it yourself as:

$ gem install quick_store

Usage

require 'quick_store'

Configuration

QuickStore.configure do |config|
  config.file_path = 'path/to/store/file.yml'
  config.key_separator = '|' # default is '/'
end

Storing, fetching, and deleting data

You can store, receive, and remove data from the store by using different methods:

# Using dynamic setters and getters
QuickStore.store.arbitrary_key = 'value'      # => "value"
QuickStore.store.arbitrary_key                # => "value"
QuickStore.store.delete_arbitrary_key         # => "value"

# Using the ::set, ::get, and ::delete methods
QuickStore.store.set(:arbitrary_key, 'value') # => "value"
QuickStore.store.get(:arbitrary_key)          # => "value"
QuickStore.store.delete(:arbitrary_key)       # => "value"

# Example for a nested key ('/' is the default key separator)
QuickStore.store.set('a/b/c', 'value')        # => {"b"=>{"c"=>"value"}}

QuickStore.store.get('a/b/c')                 # => "value"
QuickStore.store.get('a/b')                   # => {"c"=>"value"}
QuickStore.store.get('a')                     # => {"b"=>{"c"=>"value"}}

# Removing data for a certain nested key
QuickStore.store.delete('a/b/c')              # => {"b"=>{"c"=>nil}}
QuickStore.store.get('a')                     # => {"b"=>{"c"=>nil}}

# Removing data for all nested keys under a certain key
QuickStore.store.delete('a')                  # => {"b"=>{"c"=>nil}}
QuickStore.store.get('a')                     # => nil

Contributing

  1. Fork it ( https://github.com/[my-github-username]/quick_store/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

The quick_store gem is released under the MIT License.


*Note that all licence references and agreements mentioned in the QuickStore README section above are relevant to that project's source code only.