UIDAttribute version
set :uid_attribute
# File lib/uid_attribute.rb, line 61 def set_uid klass = self.class has_uid_accessors? uid = klass.uid_object ? UUIDTools::UUID.md5_create(UUIDTools::UUID_OID_NAMESPACE, self.inspect) : UUIDTools::UUID.random_create.to_s send("#{klass.uid_attr}=", uid) end
raises errors unless the including class has a setter and getter for Klass.uid_attr
# File lib/uid_attribute.rb, line 78 def has_uid_accessors? klass = self.class uid_attr = klass.uid_attr raise "dev.error: #{klass}.respond_to?(:#{uid_attr}) == false" unless respond_to?(uid_attr) raise "dev.error: #{klass}.respond_to?(:#{uid_attr}=) == false" unless respond_to?("#{uid_attr}=") end
Generated with the Darkfish Rdoc Generator 2.