Sha256: d610817462fccae73638f646d683061e7866513a15df482ac6716af253f17be2

Contents?: true

Size: 600 Bytes

Versions: 2

Compression:

Stored size: 600 Bytes

Contents

#
# To run this example, simply do
#
#   ruby breakpoint-exqample.rb
#
# It will escape to IRB at various points.  You can query the local variables, etc., and even
# try a "throw :debug_return, 5" to force a return from the method.
#

begin
  require 'rubygems'
rescue LoadError
end
require 'dev-utils/debug'

class Person
  def initialize(name, age)
    @name, @age = name, age
    breakpoint 'Person#initialize'
  end

  attr_reader :age
  def name
    breakpoint('Person#name') { @name }
  end
end

person = Person.new('John Smith', 23)
puts "Name: #{person.name}"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dev-utils-1.0 examples/breakpoint-example.rb
dev-utils-1.0.1 examples/breakpoint-example.rb