01 — blocks
The loop’s body is handed to the method — iteration reads like prose.
%w[perch sundial].each do |app|
puts app.capitalize
end§ 02 — Eras · 1995
optimized for programmer happiness
Left: era context, features, and the 101 hello. Right: 3 core concepts, 3 deeper 201 lessons, the factorial specimen, and where Ruby lives today — each column scrolls on its own.
Programmer joy: Matz optimized for human happiness — productivity first, elegance as a feature, not an accident.
Slower than its peers, hospitable to monkey-patch chaos, and its fate married to a single framework.
Session one is the smallest program that still counts as speaking Ruby: what every tutorial prints first, in the dialect that mattered when the language arrived (1995).
puts "Hello, world"101First contact — hello world and 3 ideas that define how Ruby reads. 201 — 3 lessons on mechanisms you meet after the factorial specimen: the sharp edges practitioners actually use.
3 fragments, each naming a habit of mind in Ruby. Read the note, then the code — together they are the 101 in one sitting.
01 — blocks
The loop’s body is handed to the method — iteration reads like prose.
%w[perch sundial].each do |app|
puts app.capitalize
end02 — everything is an expression
if, case, begin…end all return values; the language flows.
wage = 24
label = if wage > 20 then "senior" else "junior" end03 — open classes
Any class can grow — the dynamism Rails is built on (and occasionally undone by).
class String
def shout
upcase + "!"
end
end
"hello".shoutThe 201 assumes you have read the 101 and the specimen. Each lesson is one mechanism — what it is for, how it looks in code, and the trap or payoff that makes Ruby distinctive at scale.
A block is code handed to a method; a proc is the same thing as an object; a lambda is a proc with strict arity — three names for one idea.
add = ->(a, b) { a + b }
add.lambda? #=> true (strict arity)
add = proc { |a, b| a + b }Enumerable and Comparable are modules mixed into core classes — inheritance replaced by composition, and the reason Ruby code reads like sentences.
class Ship
include Comparable
attr_reader :tons
def <=>(other) tons <=> other.tons end
endmethod_missing, define_method and blocks let a framework invent syntax — how Rails turned configuration into Ruby, and why Ruby looks unlike other languages.
def method_missing(name, *args)
return super unless block_given?
define_method(name) { |*a| instance_exec(*a, &Proc.new) }
endThe block: iteration written as literature — each, select, map with the loop’s body handed over in place. Designed for programmer joy, and it shows.
%w[perch sundial graymail]
.each { |app| puts app.capitalize }runruby fact.rb
Rails still launches companies; Shopify and GitHub run some of the largest Ruby codebases on Earth.