Sha256: 1f0dda52c74c1bc32a1be49977585830904be0c979d7cd2a4e72bcbb5318e79a

Contents?: true

Size: 796 Bytes

Versions: 4

Compression:

Stored size: 796 Bytes

Contents

package com.gsamokovarov.bindex;

import org.jruby.runtime.EventHook;
import org.jruby.runtime.RubyEvent;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.RubyArray;
import org.jruby.RubyException;

public class SetExceptionBindingsEventHook extends EventHook {
    public boolean isInterestedInEvent(RubyEvent event) {
        return event == RubyEvent.RAISE;
    }

    public void eventHandler(ThreadContext context, String eventName, String file, int line, String name, IRubyObject type) {
        RubyArray bindings = RubyBindingsCollector.collectCurrentFor(context);
        RubyException exception = (RubyException) context.runtime.getGlobalVariables().get("$!");

        exception.setInstanceVariable("@bindings", bindings);
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bindex-0.3.0 ext/bindex/com/gsamokovarov/bindex/SetExceptionBindingsEventHook.java
bindex-0.2.0 ext/bindex/com/gsamokovarov/bindex/SetExceptionBindingsEventHook.java
bindex-0.1.1 ext/bindex/com/gsamokovarov/bindex/SetExceptionBindingsEventHook.java
bindex-0.1.0 ext/bindex/com/gsamokovarov/bindex/SetExceptionBindingsEventHook.java