Laurent Sansonetti
lsans****@apple*****
Tue Jan 16 11:52:13 JST 2007
Hi, Quick description of what changed in the SVN today! First, we now support bit fields and ary Objective-C encodings (respectively _C_ARY_B and _C_BFLD). It means that these encodings are properly converted to Ruby and Libffi types. This was necessary to wrap the NSDecimal structure: typedef struct { signed int _exponent:8; unsigned int _length:4; // length == 0 && isNegative -> NaN unsigned int _isNegative:1; unsigned int _isCompact:1; unsigned int _reserved:18; unsigned short _mantissa[NSDecimalMaxSize]; } NSDecimal; Now this structure is properly usable from Ruby (I added test cases to be sure). Note that the fields are private (I added a new 'opaque' attribute to the Foundation metadata file). You have to use the public API to play with it. Second, it is now finally possible to override class methods from Ruby! $ irb -r osx/foundation >> include OSX => Object >> class Foo < NSObject >> def self.version >> 42 >> end >> end => nil >> Foo.oc_version => 42 It's only available via subclassing though. I didn't updated objc_export. I think that we should have a separate DSL method for this. Like: class NSObject def self.myMethod 42 end objc_export_singleton :myMethod, 'int' end We need a good name, and objc_export_singleton looks a bit long to me. Any suggestion? Laurent