From: David B. <dba...@gm...> - 2007-12-12 04:01:19
|
Hello. I am attempting to use a ruby library in an Objective-C/Cocoa application. I am having some difficulty figuring out calling conventions. For example, if the ruby class has the class initializer: def initialize(empid = "", key = "", manid = "") How do I properly initialize this from objective-c? I was doing: Class helperClass = NSClassFromString(@"EmpClass"); id helperInstance = [[helperClass alloc] init]; I am also wondering how I accesses my_url defined in the ruby class such as: class MyRubyClass < OSX::NSObject @@my_url = 'http://mywebsite.com' cattr_accessor :my_url end and while I am asking I have a method defined as def employees(opts = {}) how do I call that with the helperInstance in obj-c? Is there some reference material somewhere that would explain how to call ruby methods from objective-c somewhere? Most of the information/ examples I see assume your entire program is written in ruby but using the cocoa framework. Thank you. |