Class: DataMapper::Resource::PersistenceState
- Inherits:
-
Object
- Object
- DataMapper::Resource::PersistenceState
- Extended by:
- Equalizer
- Defined in:
- lib/dm-core/resource/persistence_state.rb,
lib/dm-core/resource/persistence_state/clean.rb,
lib/dm-core/resource/persistence_state/dirty.rb,
lib/dm-core/resource/persistence_state/deleted.rb,
lib/dm-core/resource/persistence_state/immutable.rb,
lib/dm-core/resource/persistence_state/persisted.rb,
lib/dm-core/resource/persistence_state/transient.rb
Overview
the state of the resource (abstract)
Defined Under Namespace
Classes: Clean, Deleted, Dirty, Immutable, Persisted, Transient
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
- #commit ⇒ Object
- #delete ⇒ Object
- #get(subject, *args) ⇒ Object
-
#initialize(resource) ⇒ PersistenceState
constructor
A new instance of PersistenceState.
- #rollback ⇒ Object
- #set(subject, value) ⇒ Object
Methods included from Equalizer
Constructor Details
#initialize(resource) ⇒ PersistenceState
Returns a new instance of PersistenceState.
11 12 13 14 |
# File 'lib/dm-core/resource/persistence_state.rb', line 11 def initialize(resource) @resource = resource @model = resource.model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
9 10 11 |
# File 'lib/dm-core/resource/persistence_state.rb', line 9 def model @model end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
9 10 11 |
# File 'lib/dm-core/resource/persistence_state.rb', line 9 def resource @resource end |
Instance Method Details
#commit ⇒ Object
29 30 31 |
# File 'lib/dm-core/resource/persistence_state.rb', line 29 def commit raise NotImplementedError, "#{self.class}#commit should be implemented" end |
#delete ⇒ Object
25 26 27 |
# File 'lib/dm-core/resource/persistence_state.rb', line 25 def delete raise NotImplementedError, "#{self.class}#delete should be implemented" end |
#get(subject, *args) ⇒ Object
16 17 18 |
# File 'lib/dm-core/resource/persistence_state.rb', line 16 def get(subject, *args) subject.get(resource, *args) end |
#rollback ⇒ Object
33 34 35 |
# File 'lib/dm-core/resource/persistence_state.rb', line 33 def rollback raise NotImplementedError, "#{self.class}#rollback should be implemented" end |
#set(subject, value) ⇒ Object
20 21 22 23 |
# File 'lib/dm-core/resource/persistence_state.rb', line 20 def set(subject, value) subject.set(resource, value) self end |