Module: HashBack::Resource::InstanceMethods

Defined in:
lib/hashback/resource.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject

Destroy the persisted copy of this object.



29
30
31
# File 'lib/hashback/resource.rb', line 29

def destroy
  hashback_backend.delete(_hashback_id_key)
end

#hashback_backendObject

Convenience method for accessing the backend without having to get to the obscurely-named class variable in which it’s stored.



35
36
37
# File 'lib/hashback/resource.rb', line 35

def hashback_backend
  self.class.__send__(:class_variable_get, :@@_backend)        
end

#saveObject

Saves the serialized form of this object to the configured backend store.



24
25
26
# File 'lib/hashback/resource.rb', line 24

def save
  hashback_backend[_hashback_id_key] = self
end