kimura wataru
kimur****@i*****
Sat Dec 9 19:54:39 JST 2006
Hi, RubyCocoa automatically converts Array->NSArray and Hash->NSDictionary. But treatment of nil value is different between Ruby and Cocoa. Ruby: Array, Hash key, Hash value - allows nil Cocoa: Array, Hash key - not allows nil Hash value - allows nil as NSNull I wrote a patch to add assertions at conversion and tests. * raise ArgumentError for a nil value at Array->NSArray conversion * raise ArgumentError for a nil key at Hash->NSDictionary conversion * use NSNull for a nil value of Hash at Hash->NSDictionary conversion I think this feature is useful on debugging RubyCocoa applications. ex) % ruby -rosx/cocoa -e 'OSX::NSArray.arrayWithObject([1, nil, 3])' /Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/oc_wrapper.rb:17:in `ocm_send': cannot covert to NSArray, item 1 is nil: [1, nil, 3] (ArgumentError) from /Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/oc_wrapper.rb:17:in `method_missing' -- kimura wataru -------------- next part -------------- A non-text attachment was scrubbed... Name: assert_nil.patch Type: application/octet-stream Size: 2059 bytes Desc: not available Url : http://lists.sourceforge.jp/mailman/archives/rubycocoa-devel/attachments/20061209/02636aa8/attachment.obj