[Rubycocoa-devel 806] Re: Methods not found

Back to archive index

Eloy Duran eloy.****@gmail*****
Fri Mar 2 00:21:11 JST 2007


Yes indeed :)

I don't know if there are any other methods that are important....
But would it maybe be possible/handy to just create some sort
of proxy method? Like:

def method_missing(method, *args)
  if Array.instance_methods.include? method.to_s
    self.to_a.send method, *args
  else
    super
  end
end

Then again, this probably is much slower/too much clutter.....
Anyways, I always use length so that would be a good one :)

Eloy

On 3/1/07, Laurent Sansonetti <lsans****@apple*****> wrote:
> Might be a good idea :)
>
> I also think that we should provide #length as an alias of #size (like
> the original Array does).
>
> Laurent
>
> On Mar 1, 2007, at 4:07 PM, Eloy Duran wrote:
>
> > Nice work!
> > Looks much better indeed.
> > One thing though, I don't know if this is necessary,
> > but should we also be able to pass a range to NSArray[] ?
> > Right now it only supports a integer (index).
> > Because it might be confusing to users that you are able
> > to pass a index like in in ruby but not a range.
> >
> > What do you think?
> >
> > Eloy
> >
> > On 3/1/07, Laurent Sansonetti <lsans****@apple*****> wrote:
> >> 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
> >>
> >> _______________________________________________
> >> 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
>



More information about the Rubycocoa-devel mailing list
Back to archive index