Class: Module

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

Instance Method Summary collapse

Instance Method Details

#debug_method(meth) ⇒ Object

Wraps the meth method with Byebug.start … block.



216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/byebug.rb', line 216

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)
    Byebug.start do
      byebug 2
      #{old_meth}(*args, &block)
    end
  end
  EOD
end

#post_mortem_method(meth) ⇒ Object

Wraps the meth method with Byebug.post_mortem … block.



233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/byebug.rb', line 233

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)
    Byebug.start do |dbg|
      dbg.post_mortem do
        #{old_meth}(*args, &block)
      end
    end
  end
  EOD
end