Class: DataMapper::Resource::PersistenceState::Deleted

Inherits:
Persisted show all
Defined in:
lib/dm-core/resource/persistence_state/deleted.rb

Overview

a persisted/deleted resource

Instance Attribute Summary

Attributes inherited from DataMapper::Resource::PersistenceState

#resource

Instance Method Summary collapse

Methods inherited from Persisted

#get

Methods inherited from DataMapper::Resource::PersistenceState

#get, #initialize, #rollback

Methods included from Equalizer

#equalize

Constructor Details

This class inherits a constructor from DataMapper::Resource::PersistenceState

Instance Method Details

#commitObject



15
16
17
18
19
# File 'lib/dm-core/resource/persistence_state/deleted.rb', line 15

def commit
  delete_resource
  remove_from_identity_map
  Immutable.new(resource)
end

#deleteObject



11
12
13
# File 'lib/dm-core/resource/persistence_state/deleted.rb', line 11

def delete
  self
end

#set(subject, value) ⇒ Object



7
8
9
# File 'lib/dm-core/resource/persistence_state/deleted.rb', line 7

def set(subject, value)
  raise ImmutableDeletedError, 'Deleted resource cannot be modified'
end