~/talk

Declare Victory with Class Macros

Talkat RubyConf Mini 2022 · 2022-11-15..11-17· [ruby]
links:none on file
slides:none on file

Shows that attr_reader is a class macro and walks through building a reusable cachable macro that uses define_method to create paired methods (all and all_without_cache), uses prepend and super to intercept calls, and calls a cache fetch to prevent extra API traffic. Extracts a library used at Splitwise to enqueue webhook delivery jobs on create, demos caching exchange rates to avoid free-tier limits, and references the memoize gem as a comparison.

AI-written summary · about

  1. 0:00Introduction
  2. 3:16Class macros in Ruby
  3. 9:03Real-world class macro examples
  4. 15:23Cacheable class macro
  5. 27:47Method interceptors and hooks
  6. 32:07Putting it all together
  7. 33:13Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.