Extending Ruby with Ruby
summary
Shows concrete Ruby implementations: a Python-style decorator system that registers via unary + and a class-level registry and redefines methods using the method_added hook, including a working transactional decorator that wraps ActiveRecord.transaction, memoization and parameterized retry decorators; a Scala-like partial-application hack using an underscore/partial object that binds block bindings and args; and a lazy evaluator built on BasicObject with method_missing to defer HTTP calls for streaming views. Code is packaged as a method_decorators gem, works but carries visibility, singleton-method and performance caveats.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:52Extending Ruby with Ruby
- 2:56Python decorators in Ruby
- 10:02Implementing Ruby decorators
- 15:28Scala partial application in Ruby
- 18:57Building partial application
- 22:10Haskell lazy evaluation in Ruby
- 24:15Lazy evaluation wrapper
- 26:01Lazy Ruby everywhere
- 27:49Lazy evaluation in Rails
- 28:12Conclusion and key takeaways








