lib/cistern/data.rb in cistern-0.7.0 vs lib/cistern/data.rb in cistern-0.7.1
- old
+ new
@@ -6,13 +6,19 @@
def self.backends
@backends ||= {}
end
+ def self.backend(*args, &block)
+ engine, options = args
+
+ Cistern::Data.backends[engine].new(options || {}, &block)
+ end
+
module ClassMethods
def data
- @data ||= Cistern::Data.backends[storage].new(@options || {}) { |d,k| d[k] = [] }
+ @data ||= Cistern::Data.backend(*storage) { |d,k| d[k] = [] }
end
def reset!
clear!
@data = nil
@@ -20,13 +26,12 @@
def clear!
self.data.clear
end
- def store_in(storage, options)
- @storage = storage
- @options = options
- @data = nil
+ def store_in(*args)
+ @storage = *args
+ @data = nil
end
def storage
@storage ||= :hash
end