|
From: kimura w. <ki...@us...> - 2005-11-07 14:34:13
|
Hi,
I added some changes to CVS. This changes enables automated wrapping
of Key-Value Coding accessors. When you define a subclass of
NSManagedObject, RubyCocoa defines wrappers to attributes and
relationships from CoreData models.
my Employee.rb at chapter 3.
-------------
require 'osx/cocoa'
require 'osx/coredata'
class Employee < OSX::NSManagedObject
kvc_depends_on [:lastName, :firstName], :fullNameAndID
@@temp_id = 0
def fullNameAndID
sprintf('%s, %s (%d)', lastName.to_s, firstName.to_s, employeeID)
end
ns_overrides :awakeFromInsert
def awakeFromInsert
@@temp_id += 1
self.employeeID = OSX::NSNumber.numberWithInt(@@temp_id)
end
end
-------------
A new module function OSX::CoreData.define_wrapper() is core of the
feature.
Fri, 04 Nov 2005 20:21:09 +0900, kimura wataru wrote:
>Hi,
>
>I'm trying this tutorial.
>
>I think that is possible to define wrappers automatically from
>NSManagedObjectModel#entities -> NSEntityDescription, but I do not
>know how to implement.
>
--
kimura wataru
|