Class: Eternity::ObjectTracker
- Inherits:
-
Object
- Object
- Eternity::ObjectTracker
- Extended by:
- Forwardable
- Defined in:
- lib/eternity/object_tracker.rb
Instance Method Summary collapse
- #delete ⇒ Object
- #flatten ⇒ Object
-
#initialize(options) ⇒ ObjectTracker
constructor
A new instance of ObjectTracker.
- #insert(data) ⇒ Object
- #revert ⇒ Object
- #update(data) ⇒ Object
Constructor Details
#initialize(options) ⇒ ObjectTracker
Returns a new instance of ObjectTracker.
7 8 9 |
# File 'lib/eternity/object_tracker.rb', line 7 def initialize() @changes = Restruct::MarshalArray.new end |
Instance Method Details
#delete ⇒ Object
19 20 21 |
# File 'lib/eternity/object_tracker.rb', line 19 def delete track DELETE end |
#flatten ⇒ Object
29 30 31 |
# File 'lib/eternity/object_tracker.rb', line 29 def flatten TrackFlatter.flatten changes end |
#insert(data) ⇒ Object
11 12 13 |
# File 'lib/eternity/object_tracker.rb', line 11 def insert(data) track INSERT, data end |
#revert ⇒ Object
23 24 25 26 27 |
# File 'lib/eternity/object_tracker.rb', line 23 def revert locker.lock! :revert do changes.destroy end end |
#update(data) ⇒ Object
15 16 17 |
# File 'lib/eternity/object_tracker.rb', line 15 def update(data) track UPDATE, data end |