motion/managed_object.rb in cdq-0.1.10 vs motion/managed_object.rb in cdq-0.1.11
- old
+ new
@@ -79,10 +79,14 @@
def destroy_all!
destroy_all
cdq.save
end
+ def attribute_names
+ self.entity_description.attributesByName.keys
+ end
+
def cdq(obj = nil)
if obj
super(obj)
else
@cdq_object ||= super(nil)
@@ -102,9 +106,18 @@
managedObjectContext.deleteObject(self)
end
def inspect
description
+ end
+
+ # Returns a hash of attributes for the object
+ def attributes
+ h = {}
+ entity.attributesByName.each do |name, desc|
+ h[name] = send name
+ end
+ h
end
def log(log_type = nil)
out = "\nOID: "
out << oid