From: Rod S. <rsc...@xm...> - 2002-09-30 05:52:45
|
Does RubyCocoa let you call ruby using objective-C syntax? For example, say you have the following class: class Hello def sayHello "Hello" end end From an Objective-C class can I do the following (or something similar): id hello = [Hello alloc] initialize]; NSLog(@"%@", [hello sayHello]]; I don't think RubyCocoa does this, because it's the opposite of what it is designed for. Is there perhaps another project that is working on this? Rod Schmidt infiniteNIL Software www.infinitenil.com |
From: FUJIMOTO H. <hi...@im...> - 2002-09-30 07:53:56
|
Hi Rod-san, At Sun, 29 Sep 2002 23:52:42 -0600, Rod Schmidt wrote: > Does RubyCocoa let you call ruby using objective-C syntax? For example, > say you have the following class: > > class Hello > def sayHello > "Hello" > end > end > > From an Objective-C class can I do the following (or something similar): > > id hello = [Hello alloc] initialize]; > NSLog(@"%@", [hello sayHello]]; Following code may be available for your purpose. But such conding is almost no tested currently. I am not confident about this code work. const char* ruby_script = "class Hello;def sayHello() \"Hello\" end end"; id hello = [[NSClassFromString(@"RBObject") alloc] initWithCStrig: ruby_script]; > I don't think RubyCocoa does this, because it's the opposite of what it > is designed for. Is there perhaps another project that is working on > this? You are right. I think that my decision which removed RubyCocoa.framework from RubyCocoa 0.3 was a mistake. I have a plan for RubyCocoa 0.4. Almost RubyCocoa code and libruby will be implemented as RubyCocoa.framework. This framework will be able to use directory or through osx_objc.bundle. thanks, first e-mail for this mailing list :-) -- FUJIMOTO Hisa |