A Look at Hooks
summary
Lists the actual Ruby hooks covered, shows method_missing with the proper signature and why also to implement respond_to_missing, demos new implemented roughly in Ruby vs C, warns against const_missing and recommends require/autoload instead, demonstrates module lifecycle hooks (included, prepended, inherited) and singleton-method hooks, explains implicit conversions and a working coerce example for numeric-like types, and proves at_exit blocks run in reverse registration order and how to check for exceptions.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 1:00What is a Hook
- 1:49Initialize
- 3:34MethodMissing
- 4:51Respond toMissing
- 6:02ConstantMissing
- 6:57Module Included
- 8:11Module Extended
- 8:30Prepend
- 9:09Inheritance
- 9:35Method Life Cycles
- 10:00Removing Methods
- 10:41Adding Methods
- 11:12Implicit Methods
- 12:41Explicit Methods
- 13:57Double Dispatch
related talks
29mControl methods like a pro: A guide to Ruby's awesomeness, a.k.a. metaprogramming
29mRequire Hooks: Filling the Gap in Ruby's Extensibility
29mModule Magic
30mRuby Techniques by Example
29mBoring Ruby Code
32m'method_missing' Should be Missing
40mThe Polite Programmer's Guide to Ruby Etiquette
42mRuby 2 Methodology
