module DeepStore::Model::Persistence
Public Class Methods
included(base)
click to toggle source
# File lib/deep_store/model/persistence.rb, line 4 def self.included(base) base.extend(ClassMethods) base.class_eval do attr_accessor :persisted def persisted? return(@persisted) if defined?(@persisted) @persisted = false end def save return unless __repository__.save(self) @persisted = true end def destroy __repository__.destroy(key) @persisted = true end def key KeyFactory.call(self, __settings__.fetch(:key)) end end end
Public Instance Methods
destroy()
click to toggle source
# File lib/deep_store/model/persistence.rb, line 20 def destroy __repository__.destroy(key) @persisted = true end
key()
click to toggle source
# File lib/deep_store/model/persistence.rb, line 25 def key KeyFactory.call(self, __settings__.fetch(:key)) end
persisted?()
click to toggle source
# File lib/deep_store/model/persistence.rb, line 10 def persisted? return(@persisted) if defined?(@persisted) @persisted = false end
save()
click to toggle source
# File lib/deep_store/model/persistence.rb, line 15 def save return unless __repository__.save(self) @persisted = true end