[MacRuby-devel] sharedRuntime same context as MacRuby's runtime

Louis-Philippe default at spiralix.org
Mon Nov 8 09:15:11 PST 2010


Hi,

I am trying to implement some macruby pre-initialisation inside an
Objective-C class, to enhance the Objective-C class with some ruby methods
before returning the initialized object to MacRuby.  I was wondering if the
+ MacRuby sharedRuntime execution context is the same as my MacRuby
application execution context?  Right now, it does not seem like the
sharedRuntime preparation I do inside my Objective-C initializer does affect
my MacRuby execution:

in MacRuby:

framework "MyObjCFramework"
myObject = MyClass.enhancedInitializer

in Objective-C:
// MyObjCFramework

...

+ (id)enhancedInitializer
{
id myInstance = [MyClass regularInitializer];
 NSBundle * fbundle = [NSBundle bundleForClass:[MyClass class]];
NSString * rbPath = [fbundle pathForResource:@"myClass_ruby" ofType:@"rb"];
 [[MacRuby sharedRuntime] evaluateFileAtPath:rbPath];
 return myInstance;
}

Is something like this supposed to be possible?

Thanks!

L-P
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101108/ae96e178/attachment.html>


More information about the MacRuby-devel mailing list