[MacRuby-devel] Issue with running unit tests when requiring rubygems

2011-02-11 Thread Gabriel Ayuso
I wanted to try using mocha to write unit tests with mocks. After requiring
"rubygems" a NoMethodError exception was thrown when attempting to run the
tests. The method which wasn't found was 'run'.

If I remove the call to require "rubygems" my test fails because I can't use
mocha but the NoMethodError exception which was thrown is not thrown
anymore.

Am I missing something?

Thanks,
Gabriel Ayuso
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Issue with running unit tests when requiring rubygems

2011-02-11 Thread Eloy Duran
This *might* be because the minitest version in our stdlib is
outdated. You can try to install the minitest gem and require that
instead and see if that fixes it.

On Fri, Feb 11, 2011 at 3:24 PM, Gabriel Ayuso  wrote:
> I wanted to try using mocha to write unit tests with mocks. After requiring
> "rubygems" a NoMethodError exception was thrown when attempting to run the
> tests. The method which wasn't found was 'run'.
> If I remove the call to require "rubygems" my test fails because I can't use
> mocha but the NoMethodError exception which was thrown is not thrown
> anymore.
> Am I missing something?
> Thanks,
> Gabriel Ayuso
> ___
> 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


Re: [MacRuby-devel] Issue with running unit tests when requiring rubygems

2011-02-11 Thread Joshua Ballanco
Considering that the updated minitest library also contains the new
benchmarking facilities (though I don't think that part was officially
adopted by MRI), it might be worth considering pulling from upstream.

On Fri, Feb 11, 2011 at 9:37 AM, Eloy Duran  wrote:

> This *might* be because the minitest version in our stdlib is
> outdated. You can try to install the minitest gem and require that
> instead and see if that fixes it.
>
> On Fri, Feb 11, 2011 at 3:24 PM, Gabriel Ayuso 
> wrote:
> > I wanted to try using mocha to write unit tests with mocks. After
> requiring
> > "rubygems" a NoMethodError exception was thrown when attempting to run
> the
> > tests. The method which wasn't found was 'run'.
> > If I remove the call to require "rubygems" my test fails because I can't
> use
> > mocha but the NoMethodError exception which was thrown is not thrown
> > anymore.
> > Am I missing something?
> > Thanks,
> > Gabriel Ayuso
> > ___
> > 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


Re: [MacRuby-devel] book idea - "making it look like Ruby"

2011-02-11 Thread Matt Aimonetti
Magically converting a snake_case method call to a CamelCase method dispatch
is bad for peformance and documentation.
I believe that Laurent addressed that topic a few times already but I might
be wrong.
There is currently no plan to support that approach in MacRuby.

- Matt

On Fri, Feb 4, 2011 at 1:32 PM, Rich Morin  wrote:

> At 6:57 PM -0200 2/4/11, Caio Chassot wrote:
> > On 2011-02-04, at 01:26 , Rich Morin wrote:
> > I'm sure the situation in JRuby land is worse, but
> > generally, using Cocoa stuff from MacRuby feels
> > enough like ruby, save for the HorridCamelCase,
> > but I've gotten used to that.
>
> Interestingly, JRuby does quite a bit of work to let
> folks use snake_case, instead of CamelCase.
>
> -r
> --
> http://www.cfcl.com/rdmRich Morin
> http://www.cfcl.com/rdm/resume r...@cfcl.com
> http://www.cfcl.com/rdm/weblog +1 650-873-7841
>
> Software system design, development, and documentation
> ___
> 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


Re: [MacRuby-devel] book idea - "making it look like Ruby"

2011-02-11 Thread Caio Chassot
On 2011-02-11, at 15:25 , Matt Aimonetti wrote:
> 
> Magically converting a snake_case method call to a CamelCase method dispatch
> is bad for peformance and documentation.

I'm not suggesting that this be done as part of MacRuby, but should one want to 
go ahead on their on…

Wouldn't it be possible to, strictly in Objective-C, go over the headers for 
each framework and generate equivalent snake_case entries directly in the 
method tables pointing to the same method addresses as the original CamelCase 
selectors?

With that approach there would be no runtime performance impact, correct?

(Disclaimer: I don't know much at all about Objective-C internals, pretty much 
nil about method dispatch in particular.)

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] book idea - "making it look like Ruby"

2011-02-11 Thread Rich Morin
At 6:09 PM -0200 2/11/11, Caio Chassot wrote:
> On 2011-02-11, at 15:25 , Matt Aimonetti wrote:
>>
>> Magically converting a snake_case method call to a
>> CamelCase method dispatch is bad for peformance
>> and documentation.

It's not clear to me that there would be a significant
performance impact.  It might be possible to do (most
of) the translations at start-up time, avoiding much
impact during execution.

The question of documentation is also somewhat iffy.
There is already a difference in appearance between
the ObjC and MacRuby calling syntaxes.  Would merely
allowing (ie, not requiring) the use of snake_case
make this much problem much worse?


At 6:09 PM -0200 2/11/11, Caio Chassot wrote:
> I'm not suggesting that this be done as part of
> MacRuby, but should one want to go ahead on their onŠ

Ruby is extremely flexible.  I'm quite sure that some
metaprogramming  could be used to prototype something
for experimentation.

If the results were interesting, but inefficient or
awkward, it might be possible to do something better
in MacRuby itself.  Note that I'm not suggesting that
Laurent would do this, just relying on the fact that
MacRuby is an Open Source project...

-r
-- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume r...@cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Software system design, development, and documentation
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] book idea - "making it look like Ruby"

2011-02-11 Thread Jordan K. Hubbard

On Feb 11, 2011, at 2:08 PM, Rich Morin wrote:

> The question of documentation is also somewhat iffy.
> There is already a difference in appearance between
> the ObjC and MacRuby calling syntaxes.  Would merely
> allowing (ie, not requiring) the use of snake_case
> make this much problem much worse?

I think this is a terrible idea.  Language consistency is important, and just 
because you can do something doesn't necessarily mean you should.

- Jordan

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Issue with running unit tests when requiring rubygems

2011-02-11 Thread Gabriel Ayuso
I did a little more testing and I found out that the problem is apparently by 
how Mocha changes Test::Unit::TestUnit.

The only way I was able to make it work was the following:

 require 'rubygems'
 gem 'mocha'
 require 'mocha'
 require 'test/unit'
 class QuickTest < Test::Unit::TestCase
include Mocha::API
def test_quick
obj = mock("test")
obj.expects(:do).returns(false)
assert( obj.do )
end
end

If I required 'mocha' after 'test/unit' then the NoMethodError exception would 
be thrown:

uncaught Objective-C/C++ exception...
2011-02-11 23:43:50.675 macruby[83143:903] *** Terminating app due to uncaught 
exception 'NoMethodError', reason: 
'/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/1.9.2/minitest/unit.rb:641:in
 `block': undefined method `run' for # 
(NoMethodError)

Gabriel Ayuso

On Feb 11, 2011, at 3:59 PM, Joshua Ballanco wrote:

> Considering that the updated minitest library also contains the new 
> benchmarking facilities (though I don't think that part was officially 
> adopted by MRI), it might be worth considering pulling from upstream.
> 
> On Fri, Feb 11, 2011 at 9:37 AM, Eloy Duran  wrote:
> This *might* be because the minitest version in our stdlib is
> outdated. You can try to install the minitest gem and require that
> instead and see if that fixes it.
> 
> On Fri, Feb 11, 2011 at 3:24 PM, Gabriel Ayuso  
> wrote:
> > I wanted to try using mocha to write unit tests with mocks. After requiring
> > "rubygems" a NoMethodError exception was thrown when attempting to run the
> > tests. The method which wasn't found was 'run'.
> > If I remove the call to require "rubygems" my test fails because I can't use
> > mocha but the NoMethodError exception which was thrown is not thrown
> > anymore.
> > Am I missing something?
> > Thanks,
> > Gabriel Ayuso
> > ___
> > 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

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] MacRuby classes delete/overwrite Objective-C classes?

2011-02-11 Thread Robert Payne
Hey All,

Do MacRuby classes completely overwrite Objective-C classes if you load one in 
with the same class name? I'm just testing the best way to communicate to a 
MacRuby class from an Objective-C class and wanted to make sure.

Robert Payne
Interactive Developer
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Core Data / MacRuby article

2011-02-11 Thread Joshua Ballanco
Great article! Regarding the sqlite store, I think it would be best to keep
the default to XML for the template...just to be consistent with Xcode's
Obj-C templates. However, it might be nice to add something to the
macruby_deploy script to switch this over to SQLite?

On Fri, Feb 11, 2011 at 1:47 AM, Matt Aimonetti wrote:

> Really cool post Morgan, regarding the default Core Data template shipping
> with MacRuby, I believe we just ported the ObjC template.
> Your suggestion to use the sqlite store by default might be a good idea,
> what do others think?
>
> - Matt
>
> On Thu, Feb 10, 2011 at 3:32 AM, Morgan Schweers wrote:
>
>> Greetings,
>> I would love feedback on an article I just put together describing how I'm
>> using Core Data (mainly just finding data, creation is another ball of wax
>> that I haven't tried to make more Ruby-ish yet) in an application I'm
>> building.
>>
>> The article is at: http://cyberfox.com/blog
>>
>> The key code is at: http://gist.github.com/818182 if you want to dive in
>> and try to make sense of it.
>>
>> Any feedback would be wonderful; it appears to work for me, but if there
>> are any issues or better ways to do what I'm doing, I'd love to hear from
>> folks who know better.  I'm also not a really great technical writer, so
>> feedback on how it's written is also welcome.
>>
>> Thanks muchly!
>>
>> --  Morgan Schweers
>>
>>
>> ___
>> 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


Re: [MacRuby-devel] MacRuby classes delete/overwrite Objective-C classes?

2011-02-11 Thread Mark Rada
Hi Robert,

Classes in ruby are open, which means that if you define it in multiple places, 
you get one class with things from all the definitions definitions.

However, if you define the same methods, then which ever method you define last 
is the one that will exist. There are also techniques for concatenating 
methods. 

If you want two classes with the same name two remain separate, consider using 
a module to create a namespace. 


Sent from my iDevice

On 2011-02-11, at 17:54, Robert Payne  wrote:

> Hey All,
> 
> Do MacRuby classes completely overwrite Objective-C classes if you load one 
> in with the same class name? I'm just testing the best way to communicate to 
> a MacRuby class from an Objective-C class and wanted to make sure.
> 
> Robert Payne
> Interactive Developer
> ___
> 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


Re: [MacRuby-devel] MacRuby classes delete/overwrite Objective-C classes?

2011-02-11 Thread Matt Aimonetti
Do MacRuby classes completely overwrite Objective-C classes if you load one in 
with the same class name?

Just to be clear, the answer is no ;)

- Matt

Sent from my iPhone

On Feb 11, 2011, at 17:00, Mark Rada  wrote:

> Hi Robert,
> 
> Classes in ruby are open, which means that if you define it in multiple 
> places, you get one class with things from all the definitions definitions.
> 
> However, if you define the same methods, then which ever method you define 
> last is the one that will exist. There are also techniques for concatenating 
> methods. 
> 
> If you want two classes with the same name two remain separate, consider 
> using a module to create a namespace. 
> 
> 
> Sent from my iDevice
> 
> On 2011-02-11, at 17:54, Robert Payne  wrote:
> 
>> Hey All,
>> 
>> Do MacRuby classes completely overwrite Objective-C classes if you load one 
>> in with the same class name? I'm just testing the best way to communicate to 
>> a MacRuby class from an Objective-C class and wanted to make sure.
>> 
>> Robert Payne
>> Interactive Developer
>> ___
>> 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


Re: [MacRuby-devel] MacRuby classes delete/overwrite Objective-C classes?

2011-02-11 Thread Mark Rada
One day I'll get this question answering thing done correctly. 

Sent from my iDevice

On 2011-02-11, at 20:05, Matt Aimonetti  wrote:

> Do MacRuby classes completely overwrite Objective-C classes if you load one 
> in with the same class name?
> 
> Just to be clear, the answer is no ;)
> 
> - Matt
> 
> Sent from my iPhone
> 
> On Feb 11, 2011, at 17:00, Mark Rada  wrote:
> 
>> Hi Robert,
>> 
>> Classes in ruby are open, which means that if you define it in multiple 
>> places, you get one class with things from all the definitions definitions.
>> 
>> However, if you define the same methods, then which ever method you define 
>> last is the one that will exist. There are also techniques for concatenating 
>> methods. 
>> 
>> If you want two classes with the same name two remain separate, consider 
>> using a module to create a namespace. 
>> 
>> 
>> Sent from my iDevice
>> 
>> On 2011-02-11, at 17:54, Robert Payne  wrote:
>> 
>>> Hey All,
>>> 
>>> Do MacRuby classes completely overwrite Objective-C classes if you load one 
>>> in with the same class name? I'm just testing the best way to communicate 
>>> to a MacRuby class from an Objective-C class and wanted to make sure.
>>> 
>>> Robert Payne
>>> Interactive Developer
>>> ___
>>> 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
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby classes delete/overwrite Objective-C classes?

2011-02-11 Thread Matt Aimonetti
Mark, your answer was great, I just wanted to make sure people reading the
thread in the future get a simple answer.
You did a great job explaining why the answer was no and I'm sure it will be
valuable to many.

- Matt

On Fri, Feb 11, 2011 at 5:35 PM, Mark Rada  wrote:

> One day I'll get this question answering thing done correctly.
>
> Sent from my iDevice
>
> On 2011-02-11, at 20:05, Matt Aimonetti  wrote:
>
> Do MacRuby classes completely overwrite Objective-C classes if you load one
> in with the same class name?
>
> Just to be clear, the answer is no ;)
>
> - Matt
>
> Sent from my iPhone
>
> On Feb 11, 2011, at 17:00, Mark Rada < 
> mr...@marketcircle.com> wrote:
>
> Hi Robert,
>
> Classes in ruby are open, which means that if you define it in multiple
> places, you get one class with things from all the definitions definitions.
>
> However, if you define the same methods, then which ever method you define
> last is the one that will exist. There are also techniques for concatenating
> methods.
>
> If you want two classes with the same name two remain separate, consider
> using a module to create a namespace.
>
>
> Sent from my iDevice
>
> On 2011-02-11, at 17:54, Robert Payne < 
> 
> robertpa...@me.com> wrote:
>
> Hey All,
>
> Do MacRuby classes completely overwrite Objective-C classes if you load one
> in with the same class name? I'm just testing the best way to communicate to
> a MacRuby class from an Objective-C class and wanted to make sure.
>
> Robert Payne
> Interactive Developer 
>
> ___
> 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
>
>
> ___
> 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


Re: [MacRuby-devel] MacRuby classes delete/overwrite Objective-C classes?

2011-02-11 Thread Robert Payne
Hey Guys,

I'm a bit unclear on this situation then.. 

If you create an Objective-C class "MyController" with methods and then a Ruby 
class "MyController" the class should combine all the methods between both 
correct?

For instance:

Objective-C Class:
#import "MyController.h"

@implementation MyController

- (void)helloWorld {
NSLog(@"hello world!");
}
@end

Ruby Class:
class MyController
end

Objective-C App Delegate Class:

#import "AppDelegate.h"
#import "MyController.h"

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)notification {
MyController *c = [[MyController alloc] init];
[c helloWorld];
}

@end

The behavior I'm expecting is to see "Hello world" in the console but it seems 
as if the entire Objective-C method was deleted. I don't have a method in the 
Ruby class called helloWorld.

Cheers,
Robert

On 12/02/2011, at 2:43 PM, Matt Aimonetti wrote:

> Mark, your answer was great, I just wanted to make sure people reading the 
> thread in the future get a simple answer.
> You did a great job explaining why the answer was no and I'm sure it will be 
> valuable to many.
> 
> - Matt
> 
> On Fri, Feb 11, 2011 at 5:35 PM, Mark Rada  wrote:
> One day I'll get this question answering thing done correctly. 
> 
> Sent from my iDevice
> 
> On 2011-02-11, at 20:05, Matt Aimonetti  wrote:
> 
>> Do MacRuby classes completely overwrite Objective-C classes if you load one 
>> in with the same class name?
>> 
>> Just to be clear, the answer is no ;)
>> 
>> - Matt
>> 
>> Sent from my iPhone
>> 
>> On Feb 11, 2011, at 17:00, Mark Rada  wrote:
>> 
>>> Hi Robert,
>>> 
>>> Classes in ruby are open, which means that if you define it in multiple 
>>> places, you get one class with things from all the definitions definitions.
>>> 
>>> However, if you define the same methods, then which ever method you define 
>>> last is the one that will exist. There are also techniques for 
>>> concatenating methods. 
>>> 
>>> If you want two classes with the same name two remain separate, consider 
>>> using a module to create a namespace. 
>>> 
>>> 
>>> Sent from my iDevice
>>> 
>>> On 2011-02-11, at 17:54, Robert Payne  wrote:
>>> 
 Hey All,
 
 Do MacRuby classes completely overwrite Objective-C classes if you load 
 one in with the same class name? I'm just testing the best way to 
 communicate to a MacRuby class from an Objective-C class and wanted to 
 make sure.
 
 Robert Payne
 Interactive Developer
 ___
 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
> 
> ___
> 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


Re: [MacRuby-devel] MacRuby classes delete/overwrite Objective-C classes?

2011-02-11 Thread Caio Chassot
On 2011-02-12, at 01:59 , Robert Payne wrote:
> 
> The behavior I'm expecting is to see "Hello world" in the console but it 
> seems as if the entire Objective-C method was deleted. I don't have a method 
> in the Ruby class called helloWorld.

There's likely something wrong somewhere else in your project. If you post the 
whole compilable thing to github maybe we can take a look.

This works:

$ cat foo.m
#import 
@interface Foo : NSObject {}
-(NSString*) helloWorld;
@end

@implementation Foo
-(NSString*) helloWorld {
  return @"hello";
}
@end

int main (int argc, const char * argv[]) {
  [[MacRuby sharedRuntime] evaluateFileAtPath:@"foo.rb"];
  Foo* foo = [Foo new];
  NSLog(@"IM IN UR OBJC %@", [foo helloWorld]);
  NSLog(@"IM IN UR OBJC %@", [foo performRubySelector:@selector(helloRuby)]);
  // you could use the following too but it would generate a compile warning:
  // NSLog(@"IM IN UR OBJC %@", [foo helloRuby]);
  return 0;
}

$ cat foo.rb
class Foo
  def helloRuby
"hello ruby"
  end
end

NSLog("IM IN UR RUBY: %@", Foo.new.helloWorld)
NSLog("IM IN UR RUBY: %@", Foo.new.helloRuby)

$ clang -o foo foo.m -fobjc-gc-only -framework MacRuby -framework Foundation
$ ./foo 
2011-02-12 04:36:21.709 foo[26994:903] IM IN UR RUBY: hello
2011-02-12 04:36:21.713 foo[26994:903] IM IN UR RUBY: hello ruby
2011-02-12 04:36:21.714 foo[26994:903] IM IN UR OBJC hello
2011-02-12 04:36:21.714 foo[26994:903] IM IN UR OBJC hello ruby

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel