Laurent Sansonetti
lsans****@apple*****
Thu Mar 1 23:49:45 JST 2007
I profited of this to do a quick refactoring. The #to_a, #to_i and #to_f methods in oc_wrapper.rb aren't really necessary anymore now (I guess there were there for historical reasons). Also, in oc_attachments*.rb, it's no longer needed to use sub modules as we can add the methods on the fly directly to the right classes (which should also be faster). Committed as r1610. Laurent On Mar 1, 2007, at 3:20 PM, Laurent Sansonetti wrote: > Good catch! The following patch fixes the problem (so you can call > #to_a on an enumerator again): > > Index: framework/src/ruby/osx/objc/oc_wrapper.rb > =================================================================== > --- framework/src/ruby/osx/objc/oc_wrapper.rb (revision 1606) > +++ framework/src/ruby/osx/objc/oc_wrapper.rb (working copy) > @@ -66,14 +66,14 @@ > end > > def to_a > - if self.ocm_send(:isKindOfClass_, OSX::NSArray) != 0 then > + if self.ocm_send(:isKindOfClass_, OSX::NSArray) > ary = Array.new > iter = self.ocm_send(:objectEnumerator) > while obj = iter.ocm_send(:nextObject) do > ary.push(obj) > end > ary > - elsif self.ocm_send(:isKindOfClass_, OSX::NSEnumerator) != 0 > then > + elsif self.ocm_send(:isKindOfClass_, OSX::NSEnumerator) > self.ocm_send(:allObjects).to_a > else > [ self ] > > Laurent > > On Mar 1, 2007, at 2:45 PM, Jacob Wallström wrote: > >> Hi Laurent, >> >> While preparing the demo for you I turned out to be mistaken. The >> whole line looked like this: >> >> session.changeEnumeratorForEntityNames([syncName]).to_a >> >> The changeEnumeratorForEntityNames method returns a NSEnumerator. For >> some reason the above call was working in RubyCocoa 0.4.3d2. Changing >> the code to >> >> session.changeEnumeratorForEntityNames([syncName]).allObjects >> >> made it work in RubyCocoa 1.0 too. Sorry about that. >> >> /Jacob >> >> On 28 feb 2007, at 16.48, Laurent Sansonetti wrote: >> >> >>> Hi Jacob, >> >>> >> >>> This is a weird problem. At a glance ISDChangeEnumerator is a valid >> >>> subclass of NSEnumerator so there is no reason why [- >> >>> objectEnumerator] >> >>> is called on it. Could you isolate this problem in a separate/ >> >>> distinct >> >>> project and send it to the list? I may be able to fix it if I can >> >>> reproduce it. >> >>> >> >>> Thanks! >> >>> Laurent >> >>> >> >>> On Feb 28, 2007, at 4:26 PM, Jacob Wallström wrote: >> >>> >> >>> >> >>> >>>> I'm trying out RubyCocoa pre-1.0 from the unstable branch (rev. >> >>> >> >>> >>>> 1600). One problem I have run into is the following: >> >>> >> >>> >>>> >> >>> >> >>> >>>> Exception thrown: Can't get Objective-C method signature for >> >>> >>>> selector >> >>> >> >>> >>>> 'objectEnumerator' of receiver #<OSX::ISDChangeEnumerator:0x39d032 >> >>> >> >>> >>>> class='ISDChangeEnumerator' id=0x15cb3590> >> >>> >> >>> >>>> /Checkedout/JacobDocs/GhostAction/trunk/GhostAction/build/ >> >>> >> >>> >>>> Development/ >> >>> >> >>> >>>> Ghost Action.app/Contents/Frameworks/RubyCocoa.framework/Resources/ >> >>> >> >>> >>>> ruby/osx/objc/oc_wrapper.rb:63:in `ocm_send' >> >>> >> >>> >>>> /Checkedout/JacobDocs/GhostAction/trunk/GhostAction/build/ >> >>> >> >>> >>>> Development/ >> >>> >> >>> >>>> Ghost Action.app/Contents/Frameworks/RubyCocoa.framework/Resources/ >> >>> >> >>> >>>> ruby/osx/objc/oc_wrapper.rb:63:in `to_a' >> >>> >> >>> >>>> >> >>> >> >>> >>>> I get it when I make the following call: >> >>> >> >>> >>>> >> >>> >> >>> >>>> # session is a proper ISyncSession object >> >>> >> >>> >>>> session >> >>> >> >>> >>>> .changeEnumeratorForEntityNames(["com.apple.calendars.Calendar"]) >> >>> >> >>> >>>> >> >>> >> >>> >>>> The same code was working under 0.4.3d2 (I had imported the Sync >> >>> >> >>> >>>> Services classes myself), but when trying with pre-1.0 I get the >> >>> >> >>> >>>> error above. >> >>> >> >>> >>>> >> >>> >> >>> >>>> I'm grateful for any advice. >> >>> >> >>> >>>> >> >>> >> >>> >>>> Best regards, >> >>> >> >>> >>>> Jacob Wallström >> >>> >> >>> >>>> http://ghostparksoftware.com >> >>> >> >>> >>>> >> >>> >> >>> >>>> >> >>> >> >>> >>>> _______________________________________________ >> >>> >> >>> >>>> Rubycocoa-devel mailing list >> >>> >> >>> >>>> Rubyc****@lists***** >> >>> >> >>> >>>> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel >> >>> >> >>> _______________________________________________ >> >>> Rubycocoa-devel mailing list >> >>> Rubyc****@lists***** >> >>> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel >> >> _______________________________________________ >> Rubycocoa-devel mailing list >> Rubyc****@lists***** >> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel > > _______________________________________________ > Rubycocoa-devel mailing list > Rubyc****@lists***** > http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel