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

#model, #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



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

def commit
  delete_resource
  remove_from_identity_map
  Immutable.new(resource)
end

#deleteObject



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

def delete
  self
end

#set(_subject, _value) ⇒ Object



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

def set(_subject, _value)
  raise ImmutableDeletedError, 'Deleted resource cannot be modified'
end