Method: PEROBS::ObjectBase.read
- Defined in:
- lib/perobs/ObjectBase.rb
.read(store, id) ⇒ Object
Read an raw object with the specified ID from the backing store and instantiate a new object of the specific type.
182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/perobs/ObjectBase.rb', line 182 def ObjectBase.read(store, id) # Read the object from database. db_obj = store.db.get_object(id) klass = store.class_map.id_to_class(db_obj['class_id']) # Call the constructor of the specified class. obj = Object.const_get(klass).allocate obj._initialize(Handle.new(store, id)) obj._deserialize(db_obj['data']) obj.restore obj end |