Ruby course

Ruby course: Getting started What Ruby is, the install and the version check, irb, a first script, and how a Ruby program is put together. Open Ruby course: Core types Variables, numbers, strings, symbols and truthiness, then nil, frozen objects, formatting, constants and random values. Open Ruby course: Control flow Conditions, loops and the operators that steer a program, with case, guard clauses and safe navigation. Open Ruby course: Collections Arrays, hashes and ranges, the Enumerable methods built on them, sorting, sets and lazy enumerators. Open f(x) Ruby course: Methods and blocks Methods, arguments, blocks, procs and lambdas, visibility, keyword arguments and recursion. Open Ruby course: Objects and modules Classes, inheritance, modules and mixins, Struct and Data, Comparable, singleton methods and value objects. Open Ruby course: Errors and debugging Exceptions and custom error classes, cleanup with ensure, warnings and logging, and the tools that find a bug. Open Ruby course: Files and text Reading, writing and watching files, paths and permissions, string tools, output and regular expressions. Open Ruby course: Time, encodings and data formats Time, dates and time zones, Unicode and encodings, then JSON, YAML, CSV, XML and configuration files. Open API Ruby course: Networking and web HTTP clients and sockets, REST APIs, WEBrick, Rack, Sinatra and Rails, from a route to a JSON API. Open Ruby course: Tools, gems and testing Gems and Bundler, Rake, the command line and logging, the structure of a gem, then Minitest and RSpec. Open Ruby course: Advanced Ruby and concurrency Metaprogramming, the object model, method_missing, DSLs and refinements, then threads, processes and fibers. Open Ruby course: CI, Python and projects A pipeline from the first job to a release, the same programs written in Python, and the projects of the course. Open

The course

A practical course that goes from the first script to a tested command line tool and a small web API. Every lesson teaches one idea with short Ruby examples, and each page ends with the previous and next lesson, so you can read the course start to finish without wondering where to click. The course is published part by part, and the tree below lists the lessons that are ready to read.

Type every example, do not just read it, and predict the output before you run it. Keep one drill file per lesson: a short daily rep beats a rare long session, and a file you can open again makes the review take minutes.

The language core comes first: the core types, control flow, collections, and the methods, blocks and objects built on them. Errors, files and text follow, then time, data formats and the network, and the web part goes from a socket to a JSON API in Rails. Testing turns the scripts into a project, the advanced part looks under the language, and the last part adds a pipeline and a comparison with Python.

Start with What is Ruby and where it runs. For the install of the interpreter on your system read Install Ruby and check the version, and for everything else about the language see the Ruby hub.

All articles