Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-debug-base.rb

Instance Method Summary collapse

Instance Method Details

#debug_method(meth) ⇒ Object

Wraps the meth method with Debugger.start … block.



259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/ruby-debug-base.rb', line 259

def debug_method(meth)
  old_meth = "__debugee_#{meth}"
  old_meth = "#{$1}_set" if old_meth =~ /^(.+)=$/
  alias_method old_meth.to_sym, meth
  class_eval <<-EOD
  def #{meth}(*args, &block)
    Debugger.start do
      debugger 2
      #{old_meth}(*args, &block)
    end
  end
  EOD
end

#post_mortem_method(meth) ⇒ Object

Wraps the meth method with Debugger.post_mortem … block.



276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/ruby-debug-base.rb', line 276

def post_mortem_method(meth)
  old_meth = "__postmortem_#{meth}"
  old_meth = "#{$1}_set" if old_meth =~ /^(.+)=$/
  alias_method old_meth.to_sym, meth
  class_eval <<-EOD
  def #{meth}(*args, &block)
    Debugger.start do |dbg|
      dbg.post_mortem do
        #{old_meth}(*args, &block)
      end
    end
  end
  EOD
end