Class: Obsidian::Rails::ModelUpdateTracker::Delta
- Inherits:
-
Object
- Object
- Obsidian::Rails::ModelUpdateTracker::Delta
- Defined in:
- lib/obsidian/rails/model_update_tracker.rb
Instance Attribute Summary collapse
-
#committed ⇒ Object
Returns the value of attribute committed.
-
#uncommitted ⇒ Object
Returns the value of attribute uncommitted.
Instance Method Summary collapse
- #<<(obj) ⇒ Object
- #class_names ⇒ Object
-
#initialize ⇒ Delta
constructor
A new instance of Delta.
- #instances ⇒ Object
- #reset ⇒ Object
- #transaction_committed ⇒ Object
- #transaction_rolled_back ⇒ Object
Constructor Details
#initialize ⇒ Delta
Returns a new instance of Delta.
9 10 11 |
# File 'lib/obsidian/rails/model_update_tracker.rb', line 9 def initialize reset end |
Instance Attribute Details
#committed ⇒ Object
Returns the value of attribute committed.
8 9 10 |
# File 'lib/obsidian/rails/model_update_tracker.rb', line 8 def committed @committed end |
#uncommitted ⇒ Object
Returns the value of attribute uncommitted.
8 9 10 |
# File 'lib/obsidian/rails/model_update_tracker.rb', line 8 def uncommitted @uncommitted end |
Instance Method Details
#<<(obj) ⇒ Object
18 19 20 |
# File 'lib/obsidian/rails/model_update_tracker.rb', line 18 def << (obj) @uncommitted << obj end |
#class_names ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/obsidian/rails/model_update_tracker.rb', line 35 def class_names set = instances.inject(Set.new) do |set,inst| set << inst.class.to_s set end set end |
#instances ⇒ Object
31 32 33 |
# File 'lib/obsidian/rails/model_update_tracker.rb', line 31 def instances @committed + @uncommitted end |
#reset ⇒ Object
13 14 15 16 |
# File 'lib/obsidian/rails/model_update_tracker.rb', line 13 def reset @committed = [] @uncommitted = [] end |
#transaction_committed ⇒ Object
22 23 24 25 |
# File 'lib/obsidian/rails/model_update_tracker.rb', line 22 def transaction_committed @committed = @committed + @uncommitted @uncommitted = [] end |
#transaction_rolled_back ⇒ Object
27 28 29 |
# File 'lib/obsidian/rails/model_update_tracker.rb', line 27 def transaction_rolled_back @uncommitted = [] end |