-
Notifications
You must be signed in to change notification settings - Fork 2
Ruby Debug Cheat Sheet
TheNotary edited this page Feb 23, 2016
·
5 revisions
####References
####Cheat Codes
- Place a breakpoint somewhere in your code
binding.pry
- Print Call Stack
caller
- Find the class of an object
1.class # => Fixnum
- See what a class inherits from
Fixnum.superclass # => Integer
- Find definition of a method on an object say
11.method(:to_s).source_location
- Print all interesting methods on a class
(Fixnum.public_instance_methods - Object.public_instance_methods).sort
- Print all interesting methods on an object
(my_object.public_methods - Object.public_instance_methods).sort