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

Instance Method Summary collapse

Instance Attribute Details

#copy=(value) ⇒ Object (writeonly)

Sets the attribute copy

Parameters:

  • value

    the value to set the attribute copy to.



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

#recallObject

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