Module: ProjectStore::Entity::Base

Includes:
MandatoryProperties
Defined in:
lib/project_store/entity/base.rb

Instance Attribute Summary collapse

Attributes included from MandatoryProperties

#name

Instance Method Summary collapse

Methods included from MandatoryProperties

#type, #type=

Instance Attribute Details

#backing_storeObject

Returns the value of attribute backing_store.



8
9
10
# File 'lib/project_store/entity/base.rb', line 8

def backing_store
  @backing_store
end

Instance Method Details

#basic_checksObject

Raises:



23
24
25
26
27
28
29
30
31
# File 'lib/project_store/entity/base.rb', line 23

def basic_checks
  raise PSE, 'Invalid entity. Missing name' unless name
  raise PSE, 'Invalid entity. You should not specify a name as it would not be taken in account' if self[:name]
  raise PSE, "Invalid entity '#{name}'. Missing type" unless type
  raise PSE, "Invalid entity '#{name}'. Forbidden 'backing_store' entry" if self[:backing_store]
  raise PSE, "Invalid entity '#{name}'. Forbidden 'basic_checks' entry" if self[:basic_checks]
  raise PSE, "Invalid entity '#{name}'. Forbidden 'save' entry" if self[:save]
  raise PSE, "Invalid entity '#{name}'. Forbidden 'internal_type' entry" if self[:internal_type]
end

#saveObject



15
16
17
18
19
20
# File 'lib/project_store/entity/base.rb', line 15

def save
  ProjectStore.logger.info "Saving '#{name}' into '#{backing_store.path}'"
  backing_store.transaction do
    backing_store[name] = self
  end
end