Class: BindingOfCaller::JRubyBindingHolder

Inherits:
Object
  • Object
show all
Defined in:
lib/binding_of_caller/jruby_interpreted.rb

Instance Method Summary collapse

Constructor Details

#initialize(binding) ⇒ JRubyBindingHolder

Returns a new instance of JRubyBindingHolder.



5
6
7
# File 'lib/binding_of_caller/jruby_interpreted.rb', line 5

def initialize(binding)
  @binding = binding
end

Instance Method Details

#eval(code, file = nil, line = nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/binding_of_caller/jruby_interpreted.rb', line 9

def eval(code, file = nil, line = nil)
  b = JRuby.dereference(RubyBinding.new(JRuby.runtime, Binding, @binding))
  if (file == nil)
    Kernel.eval code, b
  else
    Kernel.eval code, b, file, line
  end
end

#frame_descriptionObject



31
32
33
# File 'lib/binding_of_caller/jruby_interpreted.rb', line 31

def frame_description
  "#{block_desc}#{method_desc}"
end

#frame_typeObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/binding_of_caller/jruby_interpreted.rb', line 18

def frame_type
  case
    when block?
      :block
    when eval?
      :eval
    when top?
      :top
    else
      :method
  end
end