I had a little play with IRB. With some “easy” workarounds, plain Ruby at least, I was able to get IRB in the right context. However, on MacRuby (at least on 0.5), this doesn't work completely, as the binding of a proc returns the wrong context:

% ruby -e "class Foo; def initialize; p eval('self', (proc {}).binding); end; end; Foo.new"
#<Foo:0x29324>

% ruby19 -e "class Foo; def initialize; p eval('self', (proc {}).binding); end; end; Foo.new"
#<Foo:0x3e7178>

% ./miniruby -e "class Foo; def initialize; p eval('self', (proc {}).binding); end; end; Foo.new"
#<Proc:0x80004dfa0>

Anyways, the ccode is at: http://gist.github.com/131803
I haven't had any experience with IRB before, so I'm probably doing some things wrong, but this was just some napkin code. Maybe Vincent knows better how to get the right context setup and make exit/quit work as continue.

Cheers,
Eloy

On Jun 18, 2009, at 10:50 AM, Matt Aimonetti wrote:

HotConsole: http://github.com/vincentisambart/hotconsole/tree/master

It's indeed a bit like script/console or merb -i

If HotConsole can be loaded when you run your app in "dev" mode, you could easily introspect and interact with your code. Unfortunately, that wouldn't give you breakpoints and you couldn't step through a method call. But I believe Laurent has a plan for that. (he also has plenty of plans;) )

- Matt


On Thu, Jun 18, 2009 at 1:35 AM, Paul Howson <paul- li...@tdgq.com.au> wrote:
On 18/06/2009, at 5:47 PM, Matt Aimonetti wrote:

Not being able to use ruby debug in MacRuby is something that used to really bother me at first. I'm thinking about maybe hacking hotconsole so you could run it in the context of your app. That would obviously not be as nice a real debugger but that might be cool.

I'm not familiar with hotconsole. Would that be something like script/console in Rails? That would be useful.

Also, thanks Eloy for your response. Good points.

Paul

_______________________________________________
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

Reply via email to