Created — forked from Watson1978/objc-macruby.m

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Objective-C + MacRuby

View objc-macruby.m
1 2 3 4 5 6 7 8 9 10 11 12 13
#import <Foundation/Foundation.h>
#import <MacRuby/MacRuby.h>
 
int main(void)
{
id ruby;
id foo;
 
ruby = [[MacRuby sharedRuntime] evaluateFileAtPath:@"test.rb"];
foo = [ruby performRubySelector:@selector(main:) withArguments:@"from Objc", NULL];
NSLog(@"%@", foo);
NSLog(@"%@", [foo hello]);
}
View objc-macruby.m
1 2 3 4 5 6 7 8 9 10 11 12 13
def main(str)
Foo.new(str)
end
 
class Foo
def initialize(str = "")
@str = str.to_s
end
 
def hello
"Hello, MacRuby #{@str}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.