Method: PEROBS::ObjectBase#initialize
- Defined in:
- lib/perobs/ObjectBase.rb
#initialize(store) ⇒ ObjectBase
New PEROBS objects must always be created by calling # Store.new(). PEROBS users should never call this method or equivalents of derived methods directly.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/perobs/ObjectBase.rb', line 123 def initialize(store) @store = store unless @store.object_creation_in_progress ::Kernel.raise ::RuntimeError, "All PEROBS objects must exclusively be created by calling " + "Store.new(). Never call the object constructor directly." end @_id = @store._new_id @store._register_in_memory(self, @_id) ObjectSpace.define_finalizer(self, ObjectBase._finalize(@store, @_id)) @_stash_map = nil # Allocate a proxy object for this object. User code should only operate # on this proxy, never on self. @myself = POXReference.new(@store, @_id) # Let the store know that we have a modified object. @store.cache.cache_write(self) end |