I don't know if it's working "correctly", but it is functional.
I liked the breakpoint idea so much that I distilled it
into the following for 1.6.8:
module IRB
#normal usage is:
# breakpoint binding
#drops into another IRB session with the caller's binding
#exit (optional return value) to resume the broken thread
def IRB.breakpoint(workspace = nil, name="breakpoint")
puts "At #{name}:"
workspace = IRB::WorkSpace.new workspace if
workspace.is_a? Binding
@CONF[:MAIN_CONTEXT] = (irb = IRB::Irb.new(workspace)).context
oldTrap = trap 'INT' do
irb.signal_handle
end
result = catch :IRB_EXIT do
begin
irb.eval_input
rescue Exception
print $!.type, ": ", $!, "\n"
retry
end
end
trap ('INT', nil, &oldTrap)
result
end
end
def breakpoint (*args)
IRB.breakpoint(*args)
end
The main limitation of this hack verses the real one is that the caller
must explicitly pass the binding into the breakpoint. There's no
"bindingOfCaller". If you'd like to take a crack at that, I'd be most
grateful.
--
Brent Roman
mailto:brent / mbari.org http://www.mbari.org/~brent