Sha256: 39db1de107b76fe00b80c12d319a37d367d0ab4d79b1e95d8509bb632a1cc647
Contents?: true
Size: 939 Bytes
Versions: 7
Compression:
Stored size: 939 Bytes
Contents
package org.pryrepl; import org.jruby.runtime.builtin.IRubyObject; import org.jruby.runtime.EventHook; import org.jruby.runtime.RubyEvent; import org.jruby.runtime.ThreadContext; import org.jruby.RubyException; import org.jruby.RubyBinding; import org.jruby.RubyProc; public class InterceptionEventHook extends EventHook { private RubyProc proc; public InterceptionEventHook(RubyProc proc) { this.proc = proc; } public boolean isInterestedInEvent(RubyEvent event) { return event == RubyEvent.RAISE; } public void eventHandler(ThreadContext context, String eventName, String file, int line, String name, IRubyObject type) { RubyBinding binding = RubyBinding.newBinding(context.runtime, context.currentBinding()); RubyException exception = (RubyException)context.runtime.getGlobalVariables().get("$!"); proc.call(context, new IRubyObject[] {exception, binding}); } }
Version data entries
7 entries across 7 versions & 2 rubygems