Irb

Is there any way to reset irb without closing and restarting it?

On Apr 11, 2006, at 2:30 PM, Tom A. wrote:

Is there any way to reset irb without closing and restarting it?

I have this function in my .irbrc:
def reset_irb
exec($0)
end

Effectively its closing and restaring it, but its a little faster, I
think

cool.
I’ll try it, as soon as I figure out what ~/.irbc equates to under
Windows.

I use Linux at home, but I can’t get a linux machine at work. So I’m
using my spare time at work to learn Ruby on Windows, hoping that all is
reasonably transferrable.

DÅ?a Utorok 11. Apríl 2006 20:43 Tom A. napísal:

cool.
I’ll try it, as soon as I figure out what ~/.irbc equates to under
Windows.

On Win2k and later, it should be by default C:\Documents and
Settings<user
name>.irbrc

Also, the Ruby interpreter should happily take “~” as a file path even
on
Windowsenso you can have it expand into the real path with one of the
file
name manipulation functions. (Which I’ve never used, so you’re stuck to
reading the docs as to what tells you the absolute path.)

David V.

Awesome, Logan. I didn’t even know I could use an rc file.

On Wed, 2006-04-12 at 03:30 +0900, Tom A. wrote:

Is there any way to reset irb without closing and restarting it?

I don’t know if this is any help, but do you know about IRB’s
workspaces?

jobs

=> #0->irb on main (#Thread:0xb7f296f8: running)

irb “other object”

jobs

=> #0->irb on main (#Thread:0xb7f296f8: stop)

#1->irb#1 on other object (#Thread:0xb7e29e68: running)

self

=> “other object”

irb “and another”

jobs

=> #0->irb on main (#Thread:0xb7f296f8: stop)

#1->irb#1 on other object (#Thread:0xb7e29e68: stop)
#2->irb#2 on and another (#Thread:0xb7e20fc0: running)

self

=> “and another”

fg 0

=> #<IRB::Irb: @scanner=#RubyLex:0xb7e40aa0,

@context=#IRB::Context:0xb7e40dfc, @signal_status=:IN_EVAL>

jobs

=> #0->irb on main (#Thread:0xb7f296f8: running)

#1->irb#1 on other object (#Thread:0xb7e29e68: stop)
#2->irb#2 on and another (#Thread:0xb7e20fc0: stop)

self

=> main

fg 1

=> #<IRB::Irb: @scanner=#RubyLex:0xb7e29db4,

@context=#IRB::Context:0xb7e29dc8, @signal_status=:IN_EVAL>

exit

=> #<IRB::Irb: @scanner=#RubyLex:0xb7e40aa0,

@context=#IRB::Context:0xb7e40dfc, @signal_status=:IN_EVAL>

jobs

=> #0->irb on main (#Thread:0xb7f296f8: running)

#2->irb#2 on and another (#Thread:0xb7e20fc0: stop)

kill 2

=> [2]

jobs

=> #0->irb on main (#Thread:0xb7f296f8: running)

exit
$

I don’t know if this is any help, but do you know about IRB’s
workspaces?

Cool.

Workspaces seem to share class definitions (if a class is created or
modified in one workspace it is visible in all workspaces) but regular
objects created in one workspace are not available in other workspaces.

Brian

I migth have missed something along the way - what is rbr?

Ben

On Wed, Oct 15, 2008 at 7:13 AM, Tomas M.

This should be more readable…

In our standard set of aliases, it resolves to the release build of
IronRuby. rbd resolves to the debug build.