Building Ruby in Ruby
summary
Reimplements core bits of Ruby purely in Ruby: custom boolean objects with if_true/if_false methods that execute blocks and return self, and a Church-inspired natural number system built as successor/nested-number objects with zero at the base. Provides to_i conversion by applying an increment action through N layers, defines + by adding one nesting to another and * by repeated addition, and implements times as repeated block calls. Code is intentionally toy-level and labeled unsafe for production but yields addition, multiplication and repetition from a tiny object model.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 0:25Building Ruby with Ruby
- 1:54Smalltalk and booleans
- 3:38Implementing true and false
- 7:16Natural numbers concept
- 9:11Defining numbers in Ruby
- 13:09Number conversion and increment
- 15:45Addition and multiplication
- 17:15Times method in Ruby
- 17:57Q&A








