Class: DataMapper::Resource::PersistenceState::Transient

Inherits:
DataMapper::Resource::PersistenceState show all
Defined in:
lib/dm-core/resource/persistence_state/transient.rb

Overview

a not-persisted/modifiable resource

Instance Attribute Summary

Attributes inherited from DataMapper::Resource::PersistenceState

#resource

Instance Method Summary collapse

Methods inherited from DataMapper::Resource::PersistenceState

#initialize

Methods included from Equalizer

#equalize

Constructor Details

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

Instance Method Details

#commitObject



21
22
23
24
25
26
27
28
29
# File 'lib/dm-core/resource/persistence_state/transient.rb', line 21

def commit
  set_child_keys
  set_default_values
  return self unless valid_attributes?
  create_resource
  set_repository
  add_to_identity_map
  Clean.new(resource)
end

#deleteObject



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

def delete
  self
end

#get(subject, *args) ⇒ Object



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

def get(subject, *args)
  set_default_value(subject)
  super
end

#original_attributesObject



35
36
37
# File 'lib/dm-core/resource/persistence_state/transient.rb', line 35

def original_attributes
  @original_attributes ||= {}
end

#rollbackObject



31
32
33
# File 'lib/dm-core/resource/persistence_state/transient.rb', line 31

def rollback
  self
end

#set(subject, value) ⇒ Object



12
13
14
15
# File 'lib/dm-core/resource/persistence_state/transient.rb', line 12

def set(subject, value)
  track(subject)
  super
end