Module: Kernel

Defined in:
lib/ruby-debug.rb,
lib/ruby-debug-base.rb

Instance Method Summary collapse

Instance Method Details

#binding_n(n = 0) ⇒ Object

Returns a binding of n-th call frame



253
254
255
256
257
258
259
260
261
# File 'lib/ruby-debug-base.rb', line 253

def binding_n(n = 0)
  Debugger.skip do
    if RUBY_VERSION < "1.9"
      Debugger.current_context.frame_binding(n+2)
    else
      Debugger.current_context.frame_binding(n+1)
    end
  end
end

#debugger(steps = 1, &block) ⇒ Object Also known as: breakpoint

If a block is given (and the debugger hasn’t been started, we run the block under the debugger. Alas, when a block is given, we can’t support running the startup script or support the steps option. FIXME.



166
167
168
169
170
171
172
173
174
# File 'lib/ruby-debug.rb', line 166

def debugger(steps = 1)
  Debugger.start
  Debugger.run_init_script(StringIO.new)
  if 0 == steps
    Debugger.current_context.stop_frame = 0
  else
    Debugger.current_context.stop_next = steps
  end
end