Module: WebConsole::JRuby
- Defined in:
- lib/web_console/integration/jruby.rb
Defined Under Namespace
Classes: FakeJRubyBinding, FakeJRubyBindingsArray
Class Method Summary collapse
-
.interpreted_mode? ⇒ Boolean
Returns whether JRuby is ran in interpreted mode.
-
.set_exception_bindings_trace_func ⇒ Object
A proc to be used in Kernel#set_trace_func.
Class Method Details
.interpreted_mode? ⇒ Boolean
Returns whether JRuby is ran in interpreted mode.
10 11 12 13 14 15 |
# File 'lib/web_console/integration/jruby.rb', line 10 def interpreted_mode? compile_mode = ::JRuby.runtime.instance_config.compile_mode interpreted_mode = RubyInstanceConfig::CompileMode::OFF compile_mode == interpreted_mode end |
.set_exception_bindings_trace_func ⇒ Object
A proc to be used in Kernel#set_trace_func.
It sets Exception#bindings for an error with all the bindings the current ThreadContext contains.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/web_console/integration/jruby.rb', line 21 def set_exception_bindings_trace_func proc do |event, file, line, id, binding, classname| case event when 'raise' if $ERROR_INFO.bindings.empty? # binding_of_caller will generate an improperly built binding at # caller[1]. Every call to a non existent method, constant or a # local variable will result in a Java NullPointerException. # # The binding that Kernel#set_trace_func is giving us is properly # built, so we can use in place of the broken one. bindings = ::Kernel.binding.callers.drop(2).unshift(binding) $ERROR_INFO.instance_variable_set(:@bindings, bindings) end end end end |