Thanks Vincent,
You're suggestion fixed the script. The top line is the original rubycocoa line and the line below the macruby equivalent. It would be nice to add such an example to the tutorial at http://www.macruby.org/trac/wiki/MacRubyTutorial (please kind maintainer--if you are listening). It is not obvious that macruby would require quotes and a trailing colon when passing the name of a selector/method. I don't think there are any examples that cover this rule currently.
Thanks,
Tim
  
 center.addObserver_selector_name_object(self, :next_number, "next number", "com.imasender") #rubycocoa
 center.addObserver self, selector: "next_number:", name: "next number", object: "com.imasender" #macruby

On Fri, Dec 12, 2008 at 7:00 AM, <macruby-devel-request@lists.macosforge.org> wrote:
Send MacRuby-devel mailing list submissions to
       macruby-devel@lists.macosforge.org

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
or, via email, send a message with subject or body 'help' to
       macruby-devel-request@lists.macosforge.org

You can reach the person managing the list at
       macruby-devel-owner@lists.macosforge.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of MacRuby-devel digest..."


Today's Topics:

  1. I tried converting a working script rubycocoa     script to
     macruby and it failed on this line... (Tim Rand)
  2. Re: I tried converting a working script rubycocoa script to
     macruby and it failed on this line... (Vincent Isambart)


----------------------------------------------------------------------

Message: 1
Date: Thu, 11 Dec 2008 21:55:04 -0800
From: "Tim Rand" <timrandg@gmail.com>
Subject: [MacRuby-devel] I tried converting a working script rubycocoa
       script to macruby and it failed on this line...
To: macruby-devel@lists.macosforge.org
Message-ID:
       <ea8cb0bb0812112155q3c4873f1q3627a8227477eec9@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

NSDistributedNotificationCenter.defaultCenter.addObserver_selector_name_object(self,
:next_number, "next number", "com.imasender") #Working RubyCocoa line

   NSDistributedNotificationCenter.defaultCenter.addObserver self,
selector: :next_number, name: "next number", object: "com.imasender" #But
gives the error below when converted to MacRuby grammer and run with
macruby.

2008-12-11 21:45:43.448 macruby[66187:10b] *** -[Receiver next_number]:
unrecognized selector sent to instance 0x1319720
receiver.rb:29:in `run': NSInvalidArgumentException: *** -[Receiver
next_number]: unrecognized selector sent to instance 0x1319720
(RuntimeError)
   from receiver.rb:29:in `<main>'

It's driving me crazy. If the statement is a correct translation from
RubyCocoa to MacRuby syntax why am I getting a "unrecognized selector sent
to..." error?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20081211/c96e3235/attachment-0001.html>

------------------------------

Message: 2
Date: Fri, 12 Dec 2008 15:05:18 +0900
From: "Vincent Isambart" <vincent.isambart@gmail.com>
Subject: Re: [MacRuby-devel] I tried converting a working script
       rubycocoa       script to macruby and it failed on this line...
To: "MacRuby development discussions."
       <macruby-devel@lists.macosforge.org>
Message-ID:
       <7d9a1f530812112205w6bf0ed95h745b9f980bf0ad90@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi,

>     NSDistributedNotificationCenter.defaultCenter.addObserver self,
> selector: :next_number, name: "next number", object: "com.imasender" #But
> gives the error below when converted to MacRuby grammer and run with
> macruby.
>
> It's driving me crazy. If the statement is a correct translation from
> RubyCocoa to MacRuby syntax why am I getting a "unrecognized selector sent
> to..." error?

I think your selector should not be :next_number but 'next_number:'
(note the ':' at the end). Every method that has a parameter should
have its selector ending with a ':' in MacRuby.

Cheers,
Vincent


------------------------------

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


End of MacRuby-devel Digest, Vol 10, Issue 17
*********************************************