Chapter 15. Callbacks, hooks, and runtime introspection

 

In this chapter

  • Runtime callbacks: inherited, included, and more
  • The respond_to? and method_missing methods
  • Introspection of object and class method lists
  • Trapping unresolved constant references
  • Examining in-scope variables and constants
  • Parsing caller and stack trace information

 

In keeping with its dynamic nature and its encouragement of flexible, supple object and program design, Ruby provides a large number of ways to examine what’s going on while your program is running and to set up event-based callbacks and hooks—essentially, tripwires that are pulled at specified times and for specific reasons—in the form of methods with special, reserved names for which you can, if you ...

Get The Well-Grounded Rubyist now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.