Module: RST::Persistent::Persistentable

Included in:
Calendar::Calendar, Defaults
Defined in:
lib/modules/persistent/persistent.rb

Overview

The interface for persistent-able objects

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#storeObject

See Also:



27
28
29
# File 'lib/modules/persistent/persistent.rb', line 27

def store
  @store
end

Instance Method Details

#deleteObject

Remove the object from Store



35
36
37
# File 'lib/modules/persistent/persistent.rb', line 35

def delete
  self.store -= self
end

#idString

Return an unique ID (create one if not exists yet)

Returns:

See Also:



45
46
47
# File 'lib/modules/persistent/persistent.rb', line 45

def id
  @id ||= SecureRandom::hex(KEY_LENGTH)
end

#saveObject

Save the object to Store



30
31
32
# File 'lib/modules/persistent/persistent.rb', line 30

def save
  store.update(self)
end