Module: Rubernate::Peer::Container
- Defined in:
- lib/rubernate/peer.rb
Overview
This module for including to collections of Persistent objects. It adds field that contains copy of collection and controls dirty status of collection.
Instance Attribute Summary collapse
-
#copy ⇒ Object
writeonly
Sets the attribute copy.
Instance Method Summary collapse
-
#memorize! ⇒ Object
Remember state of collection.
-
#recall ⇒ Object
Returns remembered state of collection if it different now.
Instance Attribute Details
#copy=(value) ⇒ Object (writeonly)
Sets the attribute copy
74 75 76 |
# File 'lib/rubernate/peer.rb', line 74 def copy=(value) @copy = value end |
Instance Method Details
#memorize! ⇒ Object
Remember state of collection
77 78 79 |
# File 'lib/rubernate/peer.rb', line 77 def memorize! @copy = dup end |
#recall ⇒ Object
Returns remembered state of collection if it different now
82 83 84 |
# File 'lib/rubernate/peer.rb', line 82 def recall return self != @copy ? @copy : nil end |