Preface
This is the Ruby primer I hand out at the start of my Rails trainings, published as a book of its own. The goal is not to turn you into a Ruby guru — it’s the shortest useful path from "I’ve never written Ruby" to "I can read a Rails app".
Shameless plug: if you’d rather have the training itself — personalized, on-site or remote — drop me an email at sw@wintermeyer-consulting.de.
Good news first: Ruby is one of the easier languages to learn. If this is your first programming language, the syntax reads almost like pseudo-code and you’ll be writing useful little scripts sooner than you’d expect. Coming from another object-oriented language — Python, JavaScript, Java, C# — you will feel at home in an afternoon.
The honest part: if object-oriented thinking itself is new to you (procedural C, or a functional-first language like Elixir or Haskell), plan for a week or two of "wait, what’s an object, really?" before the pieces click into place. It’s a small hill, and well worth the climb. Ruby’s creator, Yukihiro Matsumoto, put the language’s character this way:
It is easy to program in Ruby, but Ruby is not a simple language.
Ten chapters cover objects, classes, variables, methods, conditionals, loops, collections and ranges — the foundations a Rails app sits on. For anything beyond the basics, David Flanagan and Yukihiro Matsumoto’s The Ruby Programming Language is where I’d send you next.
The material was originally the Ruby chapter of the Learn Ruby on Rails book and has been split page-per-section so each topic has its own URL. When you’re ready to put Ruby to work in a web framework, the Rails book is the natural next step.
Most readers will write Ruby alongside an AI coding agent, and
this book assumes you are one of them. Everything still works
if you type every character yourself. Throughout the book you
will find boxes labelled Agentic Coding Tip flagging the
Ruby-specific places where an agent reliably takes a wrong
turn (truthiness, monkey-patching core classes, symbol vs
string hash keys, and a few others), together with a concrete
CLAUDE.md rule or a prompt that keeps the agent honest. The
tips assume Claude Code as the concrete tool, but the
underlying advice applies to any capable agent.
The sidebar lets you jump to any chapter at any time — nothing is locked. That said, the book is written to be read front to back: each chapter sets up the next.
Don’t be a stranger
A book like this gets better every time a reader sends me a note.
-
Did a chapter click, or did it leave you more confused than before? Either answer is useful.
-
Found a typo, a broken example, code that no longer works on the current Ruby version, a link that 404s?
-
Missing a topic you expected? Or curious about something this book doesn’t cover?
Write me at sw@wintermeyer-consulting.de. Feedback, bug reports, kind words, angry words — all welcome.
If you’d rather go through GitHub, the source lives at wintermeyer/ruby-book. Issues, feature requests, pull requests — every one of them is appreciated.
— Stefan