class TFSGraph::PersistableEntity
Constants
- NotPersisted
Attributes
db_object[RW]
id[RW]
Public Class Methods
new(repo, args)
click to toggle source
Calls superclass method
TFSGraph::Entity::new
# File lib/tfs_graph/persistable_entity.rb, line 17 def initialize(repo, args) @repo = repo super args end
repository()
click to toggle source
# File lib/tfs_graph/persistable_entity.rb, line 13 def self.repository TFSGraph::RepositoryRegistry.instance.send "#{base_class_name.downcase}_repository" end
Public Instance Methods
delete!()
click to toggle source
# File lib/tfs_graph/persistable_entity.rb, line 30 def delete! @repo.delete(self) @db_object = nil @id = nil end
persist(id, db_object)
click to toggle source
# File lib/tfs_graph/persistable_entity.rb, line 37 def persist(id, db_object) @id ||= id @db_object = db_object self end
persisted?()
click to toggle source
# File lib/tfs_graph/persistable_entity.rb, line 22 def persisted? !db_object.nil? end
save!()
click to toggle source
# File lib/tfs_graph/persistable_entity.rb, line 26 def save! @repo.save(self) end
to_hash()
click to toggle source
Calls superclass method
TFSGraph::Entity#to_hash
# File lib/tfs_graph/persistable_entity.rb, line 53 def to_hash hash = super hash[:id] = id hash end