Development
Code
Ruby
EN
RU
Ruby
Ruby course: zero to hero
The language core, the standard library, the web, testing and pipelines, in chapters from the first script to a small API.
Open
→
All articles
ruby/
basics/
(1)
Ruby basics: irb, puts and sockets
course/
(185)
Ruby course: zero to hero
1. Getting started
(8)
Chapter overview
1.1 What is Ruby and where it runs
1.2 Install Ruby and check the version
1.3 irb: the interactive shell
1.4 Your first Ruby script
1.5 Ruby from another language
1.6 irb beyond the prompt
1.7 How a Ruby program is put together
2. Core types
(12)
Chapter overview
2.1 Variables
2.2 Numbers
2.3 Strings
2.4 Symbols
2.5 Truthiness: only false and nil
2.6 nil and object identity
2.7 Mutable, frozen and copied objects
2.8 Integers, floats and rounding
2.9 Formatting strings and numbers
2.10 Constants, globals and scope
2.11 Random numbers, ids and tokens
3. Control flow
(7)
Chapter overview
3.1 Conditions
3.2 Loops
3.3 case and when in depth
3.4 Guard clauses and modifiers
3.5 break, next, redo and retry
3.6 &&, ||, and, or and safe navigation
4. Collections
(13)
Chapter overview
4.1 Arrays
4.2 Hashes
4.3 Ranges
4.4 Enumerables
4.5 Enumerators
4.6 The array toolbox
4.7 The hash toolbox
4.8 Nested arrays and hashes
4.9 Enumerable by task
4.10 Sorting and comparison
4.11 Sets and set operations
4.12 Lazy enumerators
5. Methods and blocks
(9)
Chapter overview
5.1 Methods
5.2 Blocks, procs, lambdas
5.3 Arguments: splats and kwargs
5.4 public, protected and private
5.5 Keyword arguments and forwarding
5.6 Blocks, yield and closures
5.7 Procs, lambdas and method objects
5.8 Recursion in Ruby
6. Objects and modules
(10)
Chapter overview
6.1 Modules and mixins
6.2 Classes and objects
6.3 Inheritance
6.4 Duck typing and core idioms
6.5 Struct and Data
6.6 Comparable and Enumerable in your own class
6.7 Modules as namespaces
6.8 Singleton methods and class << self
6.9 Equality and value objects
7. Errors and debugging
(8)
Chapter overview
7.1 Exceptions
7.2 Debugging
7.3 Exception classes and custom errors
7.4 ensure, at_exit and cleanup
7.5 warn, warnings and log levels
7.6 Debugging with the debug gem
7.7 TracePoint, benchmark and profilers
8. Files and text
(14)
Chapter overview
8.1 Files and IO
8.2 Reading and writing files
8.3 Paths and directories
8.4 Binary files and streams
8.5 File metadata and permissions
8.6 Watching files for changes
8.7 String tools
8.8 puts, print and p
8.9 ERB templates
8.10 Regular expressions
8.11 Scanning and parsing strings
8.12 A text pipeline
8.13 Formatting tables in the terminal
9. Time, encodings and data formats
(12)
Chapter overview
9.1 Encodings
9.2 Time and date
9.3 Time zones and durations
9.4 Parsing and formatting dates
9.5 Unicode, bytes and encodings
9.6 JSON and YAML
9.7 CSV
9.8 YAML in depth
9.9 CSV in depth
9.10 XML and HTML
9.11 Configuration files
10. Networking and web
(13)
Chapter overview
10.1 HTTP clients
10.2 Sockets
10.3 REST APIs
10.4 WEBrick server
10.5 Rails in one lesson
10.6 Net::HTTP in depth
10.7 A REST client that survives
10.8 Rack: what a Ruby web app is
10.9 A web app with Sinatra
10.10 Rails models without the whole app
10.11 Rails controllers and views
10.12 A JSON API in Rails
11. Tools, gems and testing
(19)
Chapter overview
11.1 Gems and Bundler
11.2 Rake tasks
11.3 Environment and CLI
11.4 Logging
11.5 What is inside a gem
11.6 Bundler groups and platforms
11.7 Rake in depth
11.8 A real CLI with OptionParser
11.9 Configuration and environment
11.10 Logging in depth
11.11 Testing with Minitest
11.12 Minitest assertions
11.13 Testing a web app
11.14 Minitest in spec style
11.15 Doubles and stubs
11.16 Coverage
11.17 RSpec in one lesson
11.18 Testing files and IO
12. Advanced Ruby and concurrency
(16)
Chapter overview
12.1 Metaprogramming
12.2 Pattern matching
12.3 Modern Ruby tour
12.4 The object model and method lookup
12.5 method_missing done right
12.6 define_method and small DSLs
12.7 Refinements
12.8 Garbage collection and memory
12.9 Profiling a slow script
12.10 Pattern matching in depth
12.11 Threads and fibers
12.12 Threads, mutexes and queues
12.13 Processes, fork and signals
12.14 Fibers and the scheduler
12.15 Parallel work without a framework
13. CI, Python and projects
(37)
Chapter overview
13.1 What a CI pipeline is
13.2 Ruby in GitHub Actions
13.3 Ruby in GitLab CI
13.4 Rake as the pipeline runner
13.5 Bundler and the cache
13.6 RuboCop in the pipeline
13.7 Test reports a pipeline can read
13.8 Ruby in Docker images
13.9 Build and release a gem
13.10 Auditing dependencies
13.11 Secrets in a pipeline
13.12 One job, several Ruby versions
13.13 Artifacts against caches
13.14 Automated releases
13.15 Making a pipeline fast
13.16 Security scans
13.17 Deploying from a pipeline
13.18 Ruby tools a pipeline runs
13.19 A pipeline for a CLI gem
13.20 A pipeline for a web API
13.21 The same program in Ruby and Python
13.22 Text and files in both
13.23 HTTP and JSON in both
13.24 A CLI in both
13.25 Minitest against pytest
13.26 Gems against pip
13.27 Threads in both
13.28 The same task, measured
13.29 Capstone: todo CLI
13.30 Capstone: JSON API
13.31 Performance
13.32 Project: a log analyzer
13.33 Project: a link checker
13.34 Project: CSV to JSON converter
13.35 Project: package the CLI as a gem
13.36 Project: a pipeline for your own project
Installation
(6)
Ruby in Docker
Install Ruby on FreeBSD
Install Ruby on macOS
Install Ruby on Rocky Linux
Install Ruby on Ubuntu
Install Ruby on Windows 11
introduction/
(1)
Introduction to Ruby