Ruby Cheat Sheet

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

The reference material consulted while preparing these pages is listed in the section bibliography.

A single-page, colour-coded summary of the Ruby language and its toolchain, written against Ruby 4.0 (Ruby 4.0.7; checked 2026-10-18) — the tool map (ruby, irb, ri, gem, bundle, rake, rdbg, rbs, rubocop) and useful ruby flags, a Gemfile and gemspec skeleton, magic comments, naming conventions and require, literals, variables and assignment forms, operator and precedence highlights, control expressions, method parameter order and argument forwarding, blocks, procs and lambdas, exceptions, the object model with an ancestors sketch, one-liners for the core types, Enumerable and lazy enumerators, pattern matching, metaprogramming, threads, fibers and Ractors, standard-library one-liners, Minitest, RSpec, RBS and RuboCop, YJIT and benchmarking, and a strip of what changed since older tutorials — handy for quick memorization or as a downloadable PDF desk reference.

For the full explanation, every option, and additional examples, see the dedicated pages:

Start here — Ruby Reference.

Iteration and pattern matching — Enumerable, Enumerators and Lazy Evaluation and Pattern Matching.

Practice and evolution — What’s New and Migrating Older Code.

References

The PDF summarizes the official documentation; each source is cited in full on the page listed above that covers it, and in the section bibliography.