Hi,

At Fri, 29 Nov 2002 21:18:28 +0900,
Radek Hnilica wrote:
> But I can't do anything useful from the irb session.  What I want to
> do is look arround int variables and probably change their values.

Irb works in separated binding.

> The nearest goal is to fiddle with ruby interactively in some
> checkpoints in the program.
> 
> The far goal is to have fully interactive environment where in time of
> failure the program doesn't end but fires interactive session.

Like this?

require 'irb'
IRB.setup(nil)
irb = IRB::Irb.new(IRB::WorkSpace.new(binding))
IRB.conf[:MAIN_CONTEXT] = irb.context
a = 10
begin
  raise "#{a} left" if (a -= 1) > 0
rescue StandardError, ScriptError
  puts $!.to_s
  trap("SIGINT") {irb.signal_handle}
  catch(:IRB_EXIT) {irb.eval_input} or retry
end

-- 
Nobu Nakada