Ruby basics from irb to collections
8 steps · about 4 h 5 min · Beginner
- Try Ruby interactively in irb (tutorial, Ruby-lang.org, 20 min)
An interactive prompt makes Ruby's everything-is-an-object idea concrete in minutes.
- Define methods and interpolate strings (tutorial, Ruby-lang.org, 15 min)
Small methods with default arguments are the building blocks of every Ruby script.
- Wrap behaviour in a class (tutorial, Ruby-lang.org, 20 min)
Classes and instance variables show how Ruby organises state and behaviour.
- Branch and loop the Ruby way (reference, Ruby documentation, 30 min)
if, unless, case and modifier forms let you write conditions that read naturally.
- Master method arguments (reference, Ruby documentation, 30 min)
Keyword, optional and block arguments are everywhere in Ruby libraries.
- Transform arrays with blocks (reference, Ruby documentation, 40 min)
map, select and each_with_index replace most manual loops; scan the method list with examples.
- Store key-value data in hashes (reference, Ruby documentation, 30 min)
Hashes with symbol keys are Ruby's standard record type for config and data.
- Practise with mentored exercises (interactive, Exercism, 1 h)
Solving small graded problems turns syntax you have read into code you can write.