RbRuby

Learn Ruby – all lessons

16 lessons from beginner to advanced, building on each other and with code examples.

Beginner
1

Hello World, puts & irb

Your first Ruby program and the idea "everything is an object".

2

Variables, Types & Strings

Local variables, numbers, strings, interpolation and constants.

3

Conditions: if, unless, case

Deciding with if/elsif/else, the modifier form and the powerful case/when.

4

Loops and Iterators

times, each, upto, step, while, until and loop.

5

Defining Methods

def, default values, keyword arguments, splat and the implicit return value.

6

Arrays and Hashes

The two most important collections and their most common pitfalls.

Intermediate
7

Blocks, Procs & Lambdas

The heart of Ruby: passing code as an argument, yield and closures.

8

Symbols & Strings in Detail

Symbols vs. strings, important string methods, heredocs and frozen strings.

9

Enumerable: map, select, reduce & Co.

Processing data without loops – with the methods that arrays, hashes and ranges share.

10

Classes & Objects

Attributes, constructor, inheritance, visibility and comparisons.

11

Modules, Mixins & Comparable

include, extend, prepend, namespaces as well as Enumerable and Comparable for your own classes.

12

Struct, Data & Pattern Matching

Quick data classes with Struct, immutable ones with Data and pattern matching with case/in.

13

Errors, Files & JSON

begin/rescue/ensure, custom error classes, retry, the File API and JSON.

Advanced
14

Gems, Bundler & Tests

Installing libraries, managing dependencies per project and testing code.

15

Metaprogramming & DSLs

method_missing, define_method, open classes, refinements and self-built DSLs.

16

Ruby on Rails: the Basic Idea

MVC, convention over configuration, ActiveRecord and the typical flow of a Rails app.