RbRuby

Ruby glossary – key terms explained

ActiveRecord

The ORM of Rails: tables become classes, rows become objects, queries become methods like where.

Block

A piece of code that is passed to a method ({ |x| ... } or do ... end) and executed there via yield.

Bundler

Manages the gems of a project based on Gemfile and Gemfile.lock.

Comparable

Module that generates the operators <, >, between?, clamp etc. from <=>.

Convention over Configuration

Rails principle: sensible default names replace configuration (model Article ↔ table articles).

Data

Immutable data class (Data.define, since Ruby 3.2) with with for creating modified copies.

DSL

Domain-specific language: a mini language tailored to a subject area inside Ruby, e.g. Rails routes or RSpec.

Duck Typing

"If it quacks like a duck ...": what counts is which methods an object understands, not its class.

Enumerable

Module with methods like map, select, reduce for every class that defines each.

Gem

Ruby package (library or tool), distributed via RubyGems.org and installed with gem install.

Gemfile

File that lists the sources, Ruby version and gems of a project with version constraints.

GVL

Global VM Lock: a lock in CRuby that ensures only one thread executes Ruby code at a time.

irb

Interactive Ruby: the interactive shell for trying out Ruby expressions (read-eval-print loop).

Lambda

Strict variant of a Proc with method-like behavior (->(x) { }): checks the number of arguments, return only exits the lambda.

Mixin

Module that is mixed into classes via include to share behavior (a substitute for multiple inheritance).

Monkey Patching

Changing existing classes after the fact (e.g. class String ... end); powerful but risky. Safer: refinements.

Proc

Object that encapsulates a block; it can be stored and passed on and is generous about the number of arguments.

Rake

Build tool in Ruby: tasks are described in a Rakefile.

Safe Navigation

The operator &., which short-circuits on nil and returns nil instead of raising a NoMethodError.

Struct

Quickly created data class with attributes, ==, to_a and inspect.

Symbol

Immutable name like :status that exists in memory only once; a typical hash key.