module Leda::Store
Mix-in for defining the set of data needed from a particular backing store in a data unit. E.g., for a relational database it might be a set of tables.
A store must define the following methods:
# Dump the configured data to the specified directory # @param [Pathname] def dump(directory); end # Restore from the data found in the given directory # @param [Pathname] def restore_from(directory); end
Attributes
options[R]
Public Class Methods
default_name(clazz)
click to toggle source
# File lib/leda/store.rb, line 29 def self.default_name(clazz) clazz.name.demodulize.underscore end
find(store_name)
click to toggle source
# File lib/leda/store.rb, line 45 def self.find(store_name) registered_stores[store_name.to_s] end
included(included_into)
click to toggle source
# File lib/leda/store.rb, line 37 def self.included(included_into) register_store(included_into, default_name(included_into)) end
new(options={})
click to toggle source
# File lib/leda/store.rb, line 21 def initialize(options={}) @options = options.dup end
register_store(store_class, name)
click to toggle source
# File lib/leda/store.rb, line 41 def self.register_store(store_class, name) registered_stores[name.to_s] = store_class end
registered_stores()
click to toggle source
# File lib/leda/store.rb, line 33 def self.registered_stores @registered_stores ||= {} end
Public Instance Methods
name()
click to toggle source
# File lib/leda/store.rb, line 25 def name Store.default_name(self.class) end