great!
I can even seem to send messages directly to my MacRuby classes and
instances...
like:
id obj = [Foo new:@"objc"];
and
[obj hello];

but in the second case I get a compiler warning: "No -hello method found"??

2010/5/18 Laurent Sansonetti <lsansone...@apple.com>

> Hi Louis-Philippe,
>
> Assuming MacRuby code defines:
>
> class Foo
>  def initialize(message)
>    @message
>  end
>  def hello
>    puts "hello #{message}"
>  end
> end
>
> You should be able to retrieve a reference to Foo using:
>
> Class Foo = [[MacRuby sharedRuntime] evaluateString:@"Foo"];
>
> Or, more simply:
>
> Class foo = NSClassFromString(@"Foo");
>
> You might want to use the first way in case the class has a complex path
> (if it's defined inside modules, like "Foo::Bar").
>
> Later, you can send messages to it.
>
> id obj = [Foo performRubySelector:@selector(new:) withArguments: @"objc",
> nil];
> [obj performRubySelector:@selector(hello)];
>
> Laurent
>
> On May 18, 2010, at 2:31 PM, Louis-Philippe wrote:
>
> > Hi,
> > I don't know if this is the good list to ask this question as it is my
> first...
> > So,
> >
> > I saw how I can have a MacRuby cocoa app, importing objective-c classes.
> > I can't find info on how to do the opposite...  having an Objective-C
> cocoa app, importing and using MacRuby Classes...
> >
> > All I managed to do is to "evaluateFileAtPath:" and "evaluateString:"
> >
> > Thanks!
> >
> > L-P
> > _______________________________________________
> > MacRuby-devel mailing list
> > MacRuby-devel@lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to