Module: Cistern::Data::ClassMethods

Defined in:
lib/cistern/data.rb

Instance Method Summary collapse

Instance Method Details

#clear!Object



21
22
23
# File 'lib/cistern/data.rb', line 21

def clear!
  self.data.clear
end

#dataObject



12
13
14
# File 'lib/cistern/data.rb', line 12

def data
  @data ||= Cistern::Data.backends[storage].new(@options || {}) { |d,k| d[k] = [] }
end

#reset!Object



16
17
18
19
# File 'lib/cistern/data.rb', line 16

def reset!
  clear!
  @data = nil
end

#storageObject



31
32
33
# File 'lib/cistern/data.rb', line 31

def storage
  @storage ||= :hash
end

#store_in(storage, options) ⇒ Object



25
26
27
28
29
# File 'lib/cistern/data.rb', line 25

def store_in(storage, options)
  @storage = storage
  @options = options
  @data = nil
end