Ruby Language Documentation
Ruby Language Fundamentals
Core Built-in Classes
Core Modules
Standard Library
Metaprogramming
Concurrency and Parallelism
Performance Optimization
Testing and Quality
Development Tools
Ruby 3.4 Specific Features
Patterns and Best Practices
Ecosystem Integration
Ruby Language Fundamentals
Basic Syntax and Structure
Character Sets
A comprehensive guide to Ruby's character encoding system, covering string encodings, character s...
Line Orientation and Statement Termination
Understanding how Ruby interprets lines of code, statement termination, and the use of semicolons
Code Blocks
Learn about Ruby's approach to code blocks, indentation best practices, and code organization
Embedded Documentation (=begin/=end)
Using =begin/=end blocks for multi-line documentation and comments in Ruby code
Reserved Keywords and Identifiers
Complete list of Ruby's reserved keywords and rules for naming identifiers, variables, and methods
Language Encoding and Magic Comments
Language Encoding and Magic Comments
Comments
comments
Indentation
Indentation
Variables and Constants
Local Variables
Understanding local variable scope, naming conventions, and usage patterns in Ruby
Instance Variables (@variable)
Working with instance variables (@variable) in Ruby classes and objects
Class Variables (@@variable)
Understanding class variables (@@variable) and their shared state across class instances
Global Variables ($variable)
Using global variables ($variable) and understanding their application-wide scope
Constants and Namespacing
Defining and using constants with proper namespacing and scope resolution in Ruby
Pseudo Variables (self, nil, true, false)
Understanding Ruby's pseudo variables: self, nil, true, false, and their special behaviors
Variable Scope and Binding
Mastering variable scope rules, lexical scope, and binding objects in Ruby
Parallel Assignment
Using parallel assignment and splat operators for multiple variable assignment and array decompos...
Splat Operators in Assignment
Splat Operators in Assignment
Data Types and Literals
Numeric Literals (Integer, Float, Binary, Octal, Hex)
Working with numeric literals including integers, floats, and binary, octal, and hexadecimal repr...
String Literals
Creating and manipulating string literals with interpolation, escape sequences, and encoding
Symbol Literals
Understanding symbol literals, their immutability, and memory efficiency in Ruby
Array Literals
Creating and working with array literals using various syntaxes and shortcuts
Hash Literals
Working with hash literals, symbol keys, and the hashrocket vs colon syntax
Range Literals
Creating inclusive and exclusive ranges with the .. and ... operators
Regular Expression Literals
Creating regular expression literals with //, %r{}, and various regex modifiers
Here Documents
Using heredocs for multi-line strings and percent notation for arrays, strings, and symbols
Percent Notation
Percent Notation
String Interpolation
String Interpolation
Operators
Arithmetic Operators
Using arithmetic operators for mathematical operations: +, -, *, /, %, and **
Comparison and Equality Operators
Understanding comparison operators and the differences between ==, ===, eql?, and equal?
Logical Operators (and/or vs &&/||)
Using logical operators and understanding precedence differences between and/or and &&/||
Bitwise Operators
Working with bitwise operators for binary operations: &, |, ^, ~, <<, and >>
Range Operators
Using range operators .. and ... for creating inclusive and exclusive ranges
Assignment Operators
Understanding assignment operators including compound assignments like +=, -=, and ||=
Splat and Double Splat Operators
Using splat (*) and double splat (**) operators for array and hash argument handling
Safe Navigation Operator (&.)
Using the safe navigation operator (&.) to avoid NoMethodError on nil objects
Pattern Matching Operators
Using pattern matching operators => and in for destructuring and matching
Operator Precedence and Associativity
Understanding operator precedence rules and associativity for complex expressions
Rightward Assignment Operator (=>)
Using Ruby 3's rightward assignment operator for pattern matching.
Control Flow
if/elsif/else Statements
Using if, elsif, and else statements for conditional execution in Ruby
unless Statements
Using unless statements for negative conditional logic in Ruby
case/when Expressions
Using case/when expressions for multi-way branching and pattern matching
Modifier if and unless
Using modifier if and unless for concise single-line conditionals
Ternary Operator
Using the ternary operator (? :) for compact conditional expressions
Pattern Matching with case/in
Advanced pattern matching using case/in expressions introduced in Ruby 2.7+
Pattern Matching in Depth
Deep dive into Ruby 3's pattern matching with arrays, hashes, and custom objects.
Pattern Matching with Find Patterns
Using find patterns (*) in array pattern matching.
Pin Operator in Pattern Matching
Using the pin operator (^) to match against existing variables.
Loops and Iterators
while and until Loops
Using while and until loops for conditional iteration in Ruby
for Loops
Understanding for loops and their relationship to each method in Ruby
loop Method
Using the loop method for creating infinite loops with break conditions
times, upto, downto Methods
Using times, upto, and downto methods for numeric iteration patterns
each and Enumerator Methods
Working with each method and Enumerator objects for collection iteration
break, next, redo, retry
Using break, next, redo, and retry for loop control and flow management
Infinite Loops and Loop Control
Creating and controlling infinite loops with proper exit conditions
Methods
Method Definition and Syntax
Defining methods with proper syntax, naming conventions, and structure
Required and Optional Parameters
Working with required and optional parameters in method definitions
Default Parameter Values
Setting default values for method parameters and understanding evaluation order
Variable Arguments (*args)
Using splat operator (*args) for accepting variable number of arguments
Keyword Arguments
Using keyword arguments for clearer method interfaces and required keywords
Block Parameters (&block)
Accepting blocks as parameters using &block and yield
Method Return Values
Understanding implicit and explicit return values in Ruby methods
Method Visibility (public, protected, private)
Controlling method access with public, protected, and private visibility modifiers
Method Aliases and Undef
Creating method aliases and undefining methods dynamically
Operator Methods
Defining custom operator methods for classes like +, -, [], and =
Endless Method Definition
Using Ruby 3's endless method syntax for concise one-liner methods.
Method Definition Styles Comparison
Comparing traditional, endless, and single-line method definitions.
Blocks, Procs, and Lambdas
Block Syntax and Usage
Understanding block syntax with do/end and curly braces, and when to use each
Block Parameters and Return Values
Working with block parameters and understanding block return values
yield and block_given?
Using yield to invoke blocks and block_given? to check block presence
Proc Objects
Creating and using Proc objects for storing blocks as objects
Lambda Functions
Creating lambda functions with lambda and -> syntax
Proc vs Lambda Differences
Understanding key differences between Procs and Lambdas in argument handling and returns
Closures and Lexical Scope
Understanding closures and lexical scope in blocks, procs, and lambdas
Block to Proc Conversion
Converting blocks to Procs and vice versa using & operator
Currying and Partial Application
Using curry method for partial application and functional programming patterns
Numbered Block Parameters (_1, _2)
Using numbered parameters _1, _2, etc. in blocks for cleaner code.
Anonymous Block Arguments Best Practices
When to use it vs _1 vs named parameters in blocks.
Classes and Objects
Class Definition and Instantiation
Defining classes and creating instances with the new method
Instance Variables and Methods
Working with instance variables and instance methods in classes
Class Variables and Methods
Using class variables and class methods for shared state and behavior
Constructors (initialize)
Creating constructors with the initialize method for object setup
Inheritance and super
Implementing single inheritance and using super to call parent methods
Method Overriding
Overriding parent class methods in subclasses
Access Control
Implementing encapsulation with public, protected, and private access control
attr_accessor, attr_reader, attr_writer
Creating getters and setters with attr_accessor, attr_reader, and attr_writer
Class Constants
Defining and accessing constants within classes
Class Instance Variables
Using class instance variables as an alternative to class variables
Modules and Mixins
Module Definition
Defining modules for namespacing and mixins
Module Methods
Creating and using module methods and module functions
include Method
Understanding the differences between include, prepend, and extend for mixins
extend Method
extend Method
prepend Method
prepend Method
Module Constants
Defining and accessing constants within modules
Namespacing with Modules
Using modules to organize code and prevent naming conflicts
Method Lookup Chain
Understanding Ruby's method lookup chain and ancestor hierarchy
Module Functions
Creating dual-purpose methods with module_function
Refinements
Using refinements for scoped monkey patching
Exception Handling
begin/rescue/ensure/end
Handling exceptions with begin/rescue/ensure/end blocks
raise and fail
Raising exceptions with raise and fail methods
Exception Classes Hierarchy
Understanding Ruby's exception class hierarchy and StandardError
Custom Exception Classes
Creating custom exception classes for domain-specific errors
rescue Modifiers
Using inline rescue modifiers for simple exception handling
retry and Exception Handling
Using retry to re-execute code blocks after handling exceptions
throw and catch
Using throw and catch for non-exception control flow
Exception Backtrace
Working with exception backtraces for debugging and error reporting
Core Built-in Classes
Numeric Classes
Integer Class and Methods
Understanding Ruby's Integer class, its methods, and operations for whole number arithmetic
Float Class and Precision
Working with floating-point numbers, precision issues, and decimal arithmetic in Ruby
Rational Numbers
Using Ruby's Rational class for exact fractional arithmetic without precision loss
Complex Numbers
Working with complex numbers and mathematical operations in Ruby
Numeric Base Class
Understanding the Numeric base class and its role in Ruby's numeric hierarchy
BigDecimal for Arbitrary Precision
Using BigDecimal for high-precision decimal arithmetic in financial calculations
Numeric Coercion
How Ruby automatically converts between different numeric types
Mathematical Operations
Comprehensive guide to mathematical operations and methods in Ruby
String Class
String Creation and Literals
Different ways to create strings and understanding string literal syntax in Ruby
String Concatenation
Combining strings and embedding expressions using interpolation
String Comparison
Comparing strings for equality, ordering, and pattern matching
String Searching and Matching
Finding substrings, patterns, and positions within strings
String Substitution (sub, gsub)
Replacing text within strings using sub, gsub, and regular expressions
String Splitting and Joining
Breaking strings into arrays and combining arrays into strings
String Case Conversion
Converting between uppercase, lowercase, and other case formats
String Encoding
Understanding and managing string encoding in Ruby applications
String Formatting
Formatting strings with printf-style methods and string templates
String Iteration
Iterating over characters, bytes, lines, and codepoints in strings
String Freezing and Mutability
Understanding string mutability, freezing, and frozen string literals
Symbol Class
Symbol Creation and Usage
Creating and using symbols as immutable, memory-efficient identifiers
Symbol vs String
Understanding when to use symbols versus strings in Ruby applications
Symbol Methods
Exploring the methods available on Symbol objects
Symbol to Proc
Using the & operator to convert symbols to proc objects for cleaner code
Array Class
Array Creation and Initialization
Different ways to create and initialize arrays in Ruby
Array Access and Assignment
Accessing and modifying array elements using indexes and ranges
Array Iteration Methods
Iterating through arrays with each, map, and other enumerable methods
Array Transformation (map, select, reject)
Transforming arrays using functional programming methods
Array Sorting and Ordering
Sorting arrays and maintaining order with various comparison methods
Array Set Operations
Using arrays as sets with union, intersection, and difference operations
Array Flattening and Transposition
Working with nested arrays through flattening and transposition
Array Compaction
Removing nil values and duplicates from arrays
Array fetch_values (Ruby 3.4)
Using Ruby 3.4's fetch_values method for safe multiple element retrieval
Array Destructuring
Pattern matching and destructuring arrays in assignments
Array Uniqueness
Array Uniqueness
Hash Class
Hash Creation and Initialization
Creating hashes with literals, Hash.new, and default values
Hash Access and Assignment
Accessing and modifying hash values using keys and methods
Hash Iteration
Iterating over hash keys, values, and key-value pairs
Hash Merging and Updating
Combining hashes and updating values with merge and update methods
Hash Transformation
Transforming hash keys and values with transform methods
Hash Default Values
Setting and using default values and procs in hashes
Hash Compaction
Removing nil values from hashes with compact methods
Hash to Proc
Converting hashes to procs for functional programming patterns
Hash Capacity (Ruby 3.4)
Understanding Ruby 3.4's hash capacity parameter for performance optimization
Hash Value Omission
Ruby 3.1's hash value omission for cleaner hash literals.
Hash Shorthand Syntax
Using shorthand syntax for hash creation with matching keys and values.
Range Class
Range Creation (Inclusive/Exclusive)
Creating inclusive (..) and exclusive (...) ranges in Ruby
Range Iteration
Iterating over ranges with each, step, and other methods
Range Testing (cover?, include?)
Testing range membership with cover? and include? methods
Range to Array Conversion
Converting ranges to arrays and understanding performance implications
Endless and Beginless Ranges
Using endless and beginless ranges for open-ended comparisons
Range step with Custom Objects (Ruby 3.4)
Ruby 3.4's enhanced range stepping with custom objects using + operator
Regexp and MatchData
Regular Expression Syntax
Understanding regular expression patterns and syntax in Ruby
Pattern Matching Methods
Using match, scan, and other pattern matching methods
Capture Groups
Creating and using capture groups to extract data from strings
Named Captures
Using named captures for more readable regular expressions
Regexp Options and Modifiers
Understanding regexp flags and modifiers for case sensitivity and multiline matching
MatchData Methods
Working with MatchData objects to access captured groups and positions
bytebegin and byteend (Ruby 3.4)
Ruby 3.4's new byte-level position methods for MatchData
Regexp Timeout
Setting timeouts to prevent ReDoS attacks with complex regular expressions
Time and Date Classes
Time Class and Creation
Creating and working with Time objects in Ruby
Time Arithmetic
Performing calculations with time objects and durations
Time Formatting (strftime)
Formatting time objects with strftime patterns
Time Parsing
Parsing time strings into Time objects with various formats
Time Zones
Working with time zones and UTC in Ruby applications
Date Class
Using the Date class for date-only operations
DateTime Class
Working with DateTime objects for combined date and time operations
xmlschema and iso8601 (Ruby 3.4)
Ruby 3.4's enhanced XML Schema and ISO 8601 date/time formatting
File and IO Classes
File Operations
Basic file operations including creation, deletion, and manipulation
File Reading and Writing
Reading from and writing to files with various modes and encodings
File Permissions
Managing file permissions and access control in Ruby
IO Class Methods
Understanding the IO base class and its core methods
STDIN, STDOUT, STDERR
Working with standard input, output, and error streams
Dir Class
Directory operations and traversal with the Dir class
Pathname Class
Using Pathname for object-oriented file system operations
File.stat and File Testing
Getting file statistics and testing file properties
Process and System
Process Creation and Management
Creating and managing system processes from Ruby
Process Communication
Inter-process communication techniques in Ruby
Signal Handling
Handling system signals in Ruby applications
System Calls
Making system calls and executing shell commands from Ruby
Data Class
Data Class Introduction
Ruby 3.2's Data class for immutable value objects.
Data vs Struct Comparison
When to use Data class vs Struct for value objects.
Data Class Pattern Matching
Using Data classes with Ruby's pattern matching.
Core Modules
Kernel Module
Global Functions
Explore the global functions provided by Ruby's Kernel module
Type Conversion Methods
Learn about Kernel's type conversion methods like Integer(), Float(), String(), and Array()
Output Methods (puts, print, p)
Master Ruby's output methods: puts, print, p, and their differences
Input Methods (gets, readline)
Understanding user input methods: gets, readline, and STDIN operations
Program Termination
Learn about exit, abort, at_exit, and other program termination methods
eval and Binding
Understanding eval for dynamic code execution and Binding objects for execution context
require and load
File loading mechanisms: require, require_relative, and load methods
autoload
Lazy loading with autoload for efficient memory usage
Enumerable Module
Iteration Methods
Master Enumerable's iteration methods: each, each_with_index, each_with_object, and more
Searching and Filtering
Find and filter elements with select, reject, find, find_all, and detect methods
Transformation Methods
Transform collections with map, collect, flat_map, and zip methods
Aggregation Methods
Aggregate data with reduce, inject, sum, min, max, and count methods
Grouping and Partitioning
Organize data with group_by, partition, chunk, and slice methods
Enumerator Class
Deep dive into the Enumerator class and custom enumerator creation
External Iteration
Control iteration flow with external iterators using next, rewind, and peek
Comparable Module
Spaceship Operator (<=>)
Master the spaceship operator (<=>) for implementing comparisons
Comparison Methods
Implement comparison methods: <, <=, ==, >=, > with Comparable
between? Method
Using the between? method for range comparisons
clamp Method
Constrain values within bounds using the clamp method
Math Module
Trigonometric Functions
Work with sin, cos, tan, and other trigonometric functions in the Math module
Logarithmic Functions
Understanding log, log10, log2, and exp functions
Constants (PI, E)
Using mathematical constants: PI, E, and other Math module constants
Square Root and Power
Calculate square roots with sqrt and powers with ** operator
Hyperbolic Functions
Work with sinh, cosh, tanh, and other hyperbolic functions
ObjectSpace Module
Object Enumeration
Enumerate and inspect all living objects with ObjectSpace.each_object
Memory Management
Monitor and manage memory usage with ObjectSpace utilities
Finalizers
Set up object finalizers for cleanup operations with define_finalizer
Object Counting
Count objects by type and analyze memory allocation patterns
GC Module
Garbage Collection Control
Control garbage collection with GC.start, GC.disable, and GC.enable
GC Statistics
Monitor garbage collection performance with GC.stat
GC Compaction
Optimize memory layout with GC.compact for better performance
GC Configuration (Ruby 3.4)
Configure garbage collection parameters in Ruby 3.4 for optimal performance
Modular GC (Ruby 3.4)
Understanding Ruby 3.4's new modular garbage collection architecture
Marshal Module
Object Serialization
Serialize Ruby objects to binary format with Marshal
dump and load Methods
Save and restore objects with Marshal.dump and Marshal.load
Custom Marshaling
Implement custom serialization with marshal_dump and marshal_load
Signal Module
Signal Trapping
Handle system signals with Signal.trap for graceful shutdowns
Signal Lists
Explore available system signals and their meanings
Standard Library
Data Structures
Set and SortedSet
Complete guide to Ruby's Set and SortedSet classes for managing collections of unique elements.
Queue and SizedQueue
Thread-safe queue implementations for concurrent Ruby applications using producer-consumer patterns.
Stack Implementation
Complete guide to implementing and using stack data structures in Ruby, covering Array-based stac...
OpenStruct
A comprehensive guide to Ruby's OpenStruct class for creating objects with dynamic attribute acce...
Struct Class
A comprehensive guide to Ruby's Struct class for creating simple data container classes with name...
Network Programming
Net::HTTP
Ruby's built-in HTTP client for making requests, handling responses, and managing connections wit...
Net::FTP
A comprehensive guide to using Net::FTP for FTP client operations, file transfers, and remote ser...
Net::SMTP
Complete guide to sending emails with Ruby's Net::SMTP library including authentication, TLS encr...
Net::POP3
Technical documentation covering Net::POP3 email retrieval protocol implementation in Ruby, inclu...
Net::IMAP
Complete guide to using Net::IMAP for email server communication and mailbox management in Ruby a...
Socket Programming
Socket programming in Ruby provides network communication capabilities through TCP, UDP, and Unix...
TCPSocket and UDPSocket
Ruby network programming with TCPSocket and UDPSocket classes for TCP and UDP communication.
URI Module
Complete guide to Ruby's URI module for parsing, building, and manipulating Uniform Resource Iden...
OpenURI
A comprehensive guide to using Ruby's OpenURI library for HTTP, HTTPS, and FTP access with practi...
Happy Eyeballs v2
A comprehensive guide to using Happy Eyeballs v2 connection algorithm in Ruby's networking stack ...
Data Formats
JSON Parsing and Generation
Complete guide to parsing JSON data into Ruby objects and generating JSON strings from Ruby data ...
YAML Processing
Complete guide to parsing, generating, and manipulating YAML data using Ruby's built-in libraries...
CSV Reading and Writing
Complete guide to reading and writing CSV files in Ruby using the standard library CSV class.
XML/REXML
XML parsing and generation in Ruby using REXML for document manipulation, XPath queries, and stre...
RSS/Atom Feeds
Ruby RSS and Atom feed parsing, generation, and processing using built-in libraries and common pa...
Base64 Encoding
Ruby Base64 encoding and decoding operations for data transformation and transmission.
Database Interfaces
PStore
Ruby's PStore provides transactional, file-based object persistence with ACID-like properties for...
DBM
This guide covers Ruby's DBM interface for creating and managing persistent key-value stores usin...
GDBM
Comprehensive guide to using GDBM (GNU Database Manager) for persistent key-value storage in Ruby...
SDBM
Ruby's SDBM implementation provides a simple key-value database with persistent file storage and ...
Security and Cryptography
OpenSSL
Ruby's OpenSSL library provides cryptographic functionality including encryption, decryption, dig...
Digest Algorithms
Ruby digest algorithms provide cryptographic hash functions for data integrity verification, pass...
SecureRandom
Complete guide to Ruby's SecureRandom module for generating cryptographically secure random values.
HMAC
Ruby HMAC implementation for cryptographic message authentication using hash functions and secret...
Public Key Cryptography
Comprehensive guide to implementing public key cryptography operations in Ruby using OpenSSL bind...
SSL/TLS
Secure Socket Layer and Transport Layer Security implementation in Ruby using OpenSSL bindings fo...
File Utilities
FileUtils
This guide covers FileUtils, Ruby's standard library for file system operations including copying...
Find Module
Comprehensive guide to Ruby's Find module for directory tree traversal and file system searching ...
Tempfile
Ruby's Tempfile class creates and manages temporary files with automatic cleanup capabilities.
Pathname
Object-oriented file system path manipulation and traversal in Ruby using the Pathname class.
FileTest
Comprehensive guide to Ruby's FileTest module for testing file and directory properties and permi...
Text Processing
StringIO
Complete guide to Ruby's StringIO class for in-memory string-based I/O operations, testing scenar...
StringScanner
A guide to using StringScanner for tokenizing and parsing strings in Ruby applications.
ERB Templates
Complete guide to Ruby's ERB templating system for generating dynamic text and HTML content from ...
Scanf
Ruby string parsing and pattern extraction using format specifiers and scanning operations.
Format Strings
Ruby format strings provide multiple ways to interpolate values into strings using interpolation ...
System Utilities
OptionParser
Command-line option parsing with Ruby's OptionParser for building CLI applications and scripts.
Logger
Complete guide to Ruby's Logger class for structured application logging and debugging.
Syslog
Documentation for integrating system logging capabilities using Ruby's Syslog module for server a...
Etc Module
Ruby Etc module documentation covering system user and group information access, platform-specifi...
GetoptLong
Command-line option parsing with GetoptLong for Ruby applications and scripts.
Shellwords
A guide to Ruby's Shellwords module for safe shell command string manipulation and shell injectio...
Web and CGI
CGI Module
Technical documentation for processing HTTP requests and form data using Ruby's built-in CGI capa...
WEBrick Server
A comprehensive guide to Ruby's built-in WEBrick HTTP server library for serving web applications...
CGI Sessions
Complete guide to CGI session management in Ruby, covering creation, storage backends, security, ...
CGI Cookies
Complete guide to handling HTTP cookies in Ruby using the CGI::Cookie class for web applications ...
Compression
Zlib
Compression and decompression using Ruby's Zlib implementation of the deflate algorithm and gzip ...
GZip
Complete guide to GZip compression and decompression using Ruby's Zlib library for file processin...
Tar Archives
Working with tar archives in Ruby for creating, extracting, and manipulating compressed file coll...
Debugging Tools
Debug Gem
A comprehensive guide to Ruby's Debug Gem for interactive debugging, breakpoint management, and d...
Tracer
Line-by-line execution tracing for Ruby programs using the Tracer standard library module.
Profile
Ruby profiling tools for measuring application performance, identifying bottlenecks, and optimizi...
Debugger API
Ruby's Debugger API provides programmatic access to debugging functionality, breakpoint managemen...
Debug Gem Commands
Complete guide to Ruby's debug gem interactive debugging commands for controlling program executi...
Remote Debugging with Debug Gem
Remote debugging with the debug gem enables developers to connect debuggers to Ruby processes run...
Debug Gem Configuration
Configuration options and setup patterns for the debug gem in Ruby applications.
Date and Time Extensions
Date Calculations
A comprehensive guide to performing date arithmetic, comparisons, parsing, and formatting operati...
Chronic Duration
A comprehensive guide to parsing time durations from natural language strings using the Chronic D...
Internationalization
Encoding Classes
Ruby's encoding classes provide comprehensive text encoding management, conversion, and validatio...
Encoding Conversion
Convert text between character encodings using Ruby's built-in encoding system and String methods.
Unicode Support
A comprehensive guide to handling Unicode text encoding, conversion, and character operations in ...
Metaprogramming
Reflection and Introspection
Object Inspection Methods
Ruby's object inspection methods provide developers with tools for examining object state, struct...
Class and Module Queries
Ruby Class and Module Queries documentation covering reflection methods for inspecting class hier...
Method Queries
Method queries provide boolean-returning methods that check object state, properties, and relatio...
respond_to? and respond_to_missing?
Ruby method introspection and dynamic method handling using respond_to? and respond_to_missing?
Instance Variable Access
Instance variable access in Ruby encompasses reading, writing, and manipulating object state thro...
Constant Queries
Ruby's constant query methods provide introspection and dynamic access to constants within module...
Dynamic Method Definition
define_method
A comprehensive guide to Ruby's define_method for dynamically creating methods at runtime with pr...
method_missing
Ruby's method_missing mechanism for intercepting undefined method calls and implementing dynamic ...
const_missing
A guide to Ruby's const_missing hook method for dynamic constant resolution and autoloading patte...
Dynamic Attribute Methods
Ruby's dynamic attribute methods enable runtime creation, modification, and access of object attr...
Method Delegation
Method delegation in Ruby allows objects to forward method calls to other objects through various...
Hooks and Callbacks
included and extended
Module callback methods that execute when modules are included or extended into classes and objects.
inherited
Ruby's inherited callback method provides hooks for classes when they are subclassed, enabling me...
method_added
Ruby hook that executes callbacks whenever a method gets defined in a class or module.
method_removed
Ruby's method_removed callback system for tracking method deletion and building dynamic metaprogr...
method_undefined
Understanding Ruby's method lifecycle management through the method_undefined hook mechanism.
Evaluation Methods
eval
Ruby's eval methods execute strings as code dynamically at runtime, providing metaprogramming cap...
instance_eval
Complete guide to Ruby's instance_eval method for executing code within object contexts and creat...
class_eval and module_eval
Ruby metaprogramming methods for dynamically evaluating code within class and module contexts.
instance_exec
A guide to Ruby's instance_exec method covering execution context switching, parameter passing, a...
Binding Objects
A comprehensive guide to Ruby's Binding objects, covering context capture, variable access, eval ...
Singleton Classes
Eigenclass Concept
Ruby's eigenclass system defines singleton methods and enables per-object method definitions thro...
Singleton Methods
Methods defined on individual objects rather than classes, providing per-object behavior and enab...
Class Methods as Singleton Methods
Class methods in Ruby are implemented as singleton methods attached to the class object itself, p...
extend vs include
Ruby module inclusion mechanisms that add module methods to classes and objects through different...
Method Objects
Method Class
Ruby's Method class provides object-oriented access to methods, enabling metaprogramming patterns...
UnboundMethod Class
This guide covers UnboundMethod class for method introspection and dynamic invocation in Ruby met...
Method Binding
Method binding in Ruby enables dynamic method access, introspection, and manipulation through the...
Method Parameters
Method parameters in Ruby define how methods accept and process input, including positional, keyw...
super_method
A complete guide to Ruby's Method#super_method for debugging inheritance chains and understanding...
DSL Creation
DSL Design Patterns
DSL Design Patterns in Ruby provide techniques for creating domain-specific languages through met...
Method Chaining DSLs
Method Chaining DSLs in Ruby provide fluent interfaces for building domain-specific languages thr...
Block-based DSLs
Comprehensive guide to creating and implementing domain-specific languages using Ruby's block syn...
Class Macros
Ruby class macros that execute at class definition time to generate methods, define behavior, and...
Code Generation
Dynamic Class Creation
Dynamic class creation in Ruby allows programs to define classes at runtime using metaprogramming...
Dynamic Module Creation
A comprehensive guide to creating, modifying, and composing modules at runtime using Ruby's metap...
Runtime Code Modification
Runtime code modification in Ruby allows dynamic alteration of classes, modules, and methods duri...
Monkey Patching
Core Class Extensions
Ruby String core class extensions provide essential methods for text manipulation, encoding conve...
prepend for Method Interception
A comprehensive guide to using prepend for intercepting and extending method behavior in Ruby mod...
TracePoint API
Event Tracing
Comprehensive guide to Ruby's event tracing mechanisms including TracePoint API, trace hooks, and...
Method Call Tracking
Method Call Tracking in Ruby encompasses techniques for monitoring, intercepting, and logging met...
Exception Tracking
Exception tracking in Ruby encompasses built-in exception handling mechanisms, custom error class...
Concurrency and Parallelism
Threading
Thread Creation and Management
This guide covers creating, managing, and synchronizing threads in Ruby for concurrent programming.
Thread Safety
A comprehensive guide to writing thread-safe Ruby code, covering synchronization primitives, conc...
Thread Local Variables
Thread local variables in Ruby provide isolated storage for data that needs to be accessible with...
Thread Groups
A comprehensive guide to Ruby's ThreadGroup class for organizing and managing collections of thre...
Global VM Lock (GVL)
Comprehensive guide to Ruby's Global VM Lock (GVL), covering threading behavior, performance impl...
Ractors
Ractor Creation
Creating and managing Ractors for parallel execution in Ruby applications with isolated state and...
Message Passing
Message passing in Ruby covers method invocation, dynamic dispatch, and runtime method resolution...
Shareable Objects
A comprehensive guide to Ruby's Shareable Objects feature for safe concurrent object sharing betw...
Ractor-local Storage
A comprehensive guide to using Ractor-local storage for isolated, thread-safe data management acr...
Ractor.main?
A comprehensive guide to using Ractor.main? for identifying the main Ractor in Ruby's concurrent ...
Fibers
Fiber Creation
Creating and managing fibers for cooperative concurrency in Ruby applications.
Fiber Scheduling
A complete guide to implementing and managing fiber scheduling in Ruby for concurrent and non-blo...
Fiber Resume and Yield
A guide to Ruby's Fiber resume and yield mechanisms for cooperative multitasking and flow control.
Fiber Scheduler
A comprehensive guide to implementing and using pluggable event loops for non-blocking I/O operat...
Building Custom Fiber Schedulers
A guide to creating custom scheduler implementations for Ruby's Fiber system to control cooperati...
Fiber Scheduler with IO Operations
Fiber Scheduler with IO Operations enables non-blocking I/O through fiber-based cooperative concu...
Fiber Scheduler Performance
Ruby's fiber scheduler implementation for non-blocking I/O operations and asynchronous concurrenc...
Synchronization
Mutex
Ruby's Mutex class provides mutual exclusion locks for synchronizing access to shared resources i...
Monitor
Documentation for Ruby's Monitor class providing reentrant mutex synchronization for thread-safe ...
ConditionVariable
A guide to using ConditionVariable for thread synchronization and coordination in Ruby applications.
Barrier Synchronization
Barrier synchronization in Ruby provides coordination mechanisms for concurrent execution where m...
Process-based Parallelism
fork and Process Management
Ruby fork and Process Management for creating child processes, handling signals, and managing sys...
spawn and exec
Ruby's spawn and exec methods for creating and replacing processes to execute external commands a...
Process Pools
Managing and implementing process pools in Ruby applications.
Async I/O
Non-blocking I/O
Non-blocking I/O in Ruby provides mechanisms to perform input/output operations without blocking ...
Event Loops
Event loops provide non-blocking I/O and asynchronous execution patterns for Ruby applications th...
Async Gem
A comprehensive guide to Ruby's Async gem for building scalable asynchronous I/O applications.
Fiber Scheduler Interface
Ruby Fiber Scheduler Interface enables non-blocking I/O operations through fiber-based concurrenc...
Thread Pools
Thread Pool Patterns
Thread pool patterns in Ruby provide controlled execution of concurrent tasks by managing a fixed...
Work Queues
Work Queues in Ruby provide thread-safe data structures for coordinating work between multiple th...
Worker Threads
This guide covers Worker Threads in Ruby, including parallel execution patterns, communication me...
Performance Optimization
YJIT Compiler
YJIT Configuration
Configuration and optimization of Ruby's YJIT just-in-time compiler for production applications.
YJIT Memory Management
Comprehensive guide to managing memory allocation, code caching, and garbage collection interacti...
YJIT Statistics
Documentation for collecting, analyzing, and monitoring YJIT compiler statistics and performance ...
YJIT Logging
YJIT Logging provides comprehensive debugging and performance monitoring capabilities for Ruby's ...
Register Allocation
A comprehensive guide to Ruby's register allocation optimizations and their impact on code perfor...
Memory Management
Garbage Collection Tuning
Complete guide to optimizing Ruby's garbage collection performance through tuning parameters and ...
Object Allocation
Ruby's object allocation system manages memory distribution for instances, strings, arrays, and a...
Memory Profiling
Comprehensive guide to analyzing memory usage patterns, detecting memory leaks, and optimizing me...
Heap Compaction
Ruby's heap compaction feature that reduces memory fragmentation by relocating objects to create ...
Profiling Tools
ruby-prof
A guide to profiling Ruby applications using ruby-prof for performance analysis and optimization.
stackprof
A comprehensive guide to profiling Ruby applications using stackprof for performance analysis and...
memory_profiler
Ruby memory allocation profiling and analysis for identifying memory usage patterns, object creat...
benchmark-ips
A comprehensive guide to measuring and comparing code performance using Ruby's benchmark-ips gem ...
Optimization Techniques
Algorithm Optimization
Improving performance through better algorithm selection and optimization
Caching Strategies
Techniques and patterns for implementing efficient data caching in Ruby applications using memoiz...
Lazy Evaluation
A comprehensive guide to lazy evaluation in Ruby using Enumerator::Lazy for memory-efficient data...
Object Pooling
A comprehensive guide to implementing and managing object pools in Ruby for memory optimization a...
C Extensions and FFI
Writing C Extensions
Creating native C extensions to extend Ruby's functionality and performance capabilities.
Foreign Function Interface
Complete guide to Ruby's Foreign Function Interface for calling C libraries and managing native c...
Memory View API
Technical documentation for Ruby's Memory View API, covering efficient memory buffer access and m...
Native Extension Best Practices
Comprehensive guide to developing, building, and maintaining Ruby native extensions using C and C...
Testing and Quality
Testing Frameworks
RSpec
Complete guide to RSpec test doubles including mocks, stubs, spies, and verification patterns for...
MiniTest
Complete guide to MiniTest testing framework in Ruby, covering test definition, assertions, organ...
Test::Unit
Comprehensive guide to Test::Unit testing framework in Ruby, covering basic usage, advanced patte...
Cucumber
Behavior-driven development framework for writing executable specifications in Ruby using Gherkin...
Test Patterns
Unit Testing
Comprehensive guide to unit testing frameworks, assertion methods, test organization, mocking str...
Integration Testing
Complete guide to integration testing in Ruby covering test frameworks, database transactions, we...
Mocking and Stubbing
Guide covering test doubles, method stubs, and mock objects in Ruby testing frameworks.
Test Fixtures
Complete guide to implementing and managing test fixtures in Ruby applications for consistent, ma...
Test Factories
A comprehensive guide to creating and managing test data using factory patterns and libraries in ...
Code Quality Tools
RuboCop
A comprehensive guide to using RuboCop for static code analysis and automatic formatting in Ruby ...
Reek
A comprehensive guide to using Reek, Ruby's code smell detector, for static code analysis and qua...
SimpleCov
A comprehensive guide to SimpleCov for code coverage analysis in Ruby applications and test suites.
Brakeman
Static analysis security vulnerability scanner for Ruby on Rails applications that identifies pot...
Documentation
YARD
A comprehensive guide to using YARD for generating Ruby documentation from source code comments a...
RDoc
Documentation generation tool for parsing Ruby source code and extracting comments into formatted...
Documentation Best Practices
A comprehensive guide to documenting Ruby code effectively using RDoc, YARD, and established conv...
Development Tools
REPL Environments
IRB
Interactive Ruby interpreter for evaluating Ruby expressions in real-time with command history an...
Pry
A comprehensive guide to Pry, Ruby's interactive REPL and runtime inspection tool for debugging a...
REPL Configuration
Comprehensive guide to configuring Ruby's interactive Read-Eval-Print Loop environments including...
Package Management
RubyGems
A comprehensive guide to Ruby's package management system, covering gem installation, creation, a...
Bundler
Ruby dependency management and gem version resolution using Bundler's Gemfile and lockfile system.
Gem Creation
Complete guide to creating, building, testing, and publishing Ruby gems from initial setup throug...
Private Gem Servers
A comprehensive guide to setting up, configuring, and managing private gem repositories for Ruby ...
Version Management
rbenv
Complete guide to rbenv for managing multiple Ruby versions in development and production environ...
RVM
Complete guide to installing, configuring, and managing multiple Ruby versions with RVM across de...
chruby
A comprehensive guide to chruby installation, configuration, and usage patterns for managing Ruby...
asdf
Comprehensive guide to managing Ruby versions with asdf version manager and the asdf-ruby plugin.
Build Tools
Rake
Ruby's task execution and dependency management system for automating build processes and adminis...
Make Integration
Ruby integration with Make.com automation platform using webhooks and HTTP requests to trigger wo...
Asset Pipeline
Asset Pipeline manages compilation, minification, and serving of CSS, JavaScript, images, and oth...
Debugging
byebug
A comprehensive guide to using byebug for step-by-step debugging in Ruby applications.
pry-byebug
Ruby debugging tool that combines pry's REPL capabilities with byebug's step-through debugging fe...
Environment Management
dotenv
Managing environment variables in Ruby applications using the dotenv gem for configuration and se...
Environment Variables
Access and manage system environment variables using Ruby's ENV constant and related methods.
Configuration Management
Configuration management in Ruby through constants, class variables, environment variables, and c...
Ruby 3.4 Specific Features
The "it" Parameter
Nesting Behavior
How the 'it' parameter behaves in nested blocks and its scope limitations
Prism Parser
Parser Architecture
Parser architecture implementation patterns and techniques for building robust data parsing syste...
Migration from parse.y
A comprehensive guide to migrating Ruby applications and tools from parse.y-based parsers to mode...
Parser Selection
Ruby's mechanisms for automatically detecting data formats and selecting appropriate parsers base...
String Enhancements
append_as_bytes Method
Ruby String method for appending binary data without encoding validation or conversion, designed ...
Float Parsing Improvements
Documentation covering Ruby's enhanced float parsing capabilities, including improved accuracy, p...
Frozen String Literal Warnings
Comprehensive guide to Ruby's frozen string literal warnings system, covering pragma usage, perfo...
Hash Improvements
Capacity Parameter
A guide to using the capacity parameter in Ruby Hash initialization for memory pre-allocation and...
Modern Inspect Format
Comprehensive guide to Ruby's modern inspect format, custom inspect methods, and advanced debuggi...
Range Enhancements
step with + Operator
This guide covers Ruby's `step` method combined with the `+` operator for controlled numeric iter...
size TypeError for Non-iterable
This guide covers the size TypeError for non-iterable objects in Ruby, explaining when this error...
Exception Improvements
Backtrace Locations
A comprehensive guide to Ruby's backtrace location system for debugging, error tracking, and stac...
Error Message Format
A comprehensive guide to Ruby's error message formatting system, covering exception display, back...
set_backtrace Enhancement
Ruby set_backtrace method for customizing exception backtraces and error reporting workflows.
Ractor Enhancements
require in Ractors
A comprehensive guide to using require for loading code within Ruby's parallel execution contexts.
store_if_absent
A comprehensive guide to conditional storage patterns in Ruby, covering standard Hash operations,...
YJIT Improvements
Performance Gains
A comprehensive guide to Ruby performance optimization techniques, profiling tools, and productio...
Memory Optimization
Comprehensive guide covering memory management techniques, garbage collection optimization, and p...
YJIT New Configuration Options
Ruby configuration options control interpreter behavior, runtime settings, and application-level ...
Warning System
Warning Categories
A comprehensive guide to Ruby's warning categorization system for controlling and filtering warni...
Strict Unused Block
Comprehensive guide to Ruby's strict unused block warnings for identifying unnecessary block pass...
Breaking Changes
Index Assignment Restrictions
Index assignment restrictions define how Ruby handles value assignment to indices in arrays, hash...
**nil Keyword Splatting
A comprehensive guide to using nil keyword splatting for flexible argument handling in Ruby methods.
Reserved ::Ruby Constant
Reserved top-level constant namespace for Ruby language features and implementation-independent A...
Patterns and Best Practices
Design Patterns
Singleton Pattern
Implementation and usage of the Singleton pattern in Ruby for ensuring single instance classes an...
Factory Pattern
This guide covers implementing and using the Factory Pattern in Ruby to create objects without sp...
Observer Pattern
A comprehensive guide to implementing and using the Observer Pattern in Ruby for event-driven pro...
Decorator Pattern
A comprehensive guide to implementing and using the Decorator Pattern in Ruby for extending objec...
Strategy Pattern
Ruby Strategy Pattern documentation covering implementation techniques, advanced composition patt...
Ruby Idioms
Duck Typing
Duck typing enables objects to be used based on the methods they respond to rather than their cla...
Memoization
Caching expensive computation results in instance variables to avoid repeated calculations and im...
Method Chaining
Method chaining enables consecutive method calls on objects by returning values that support furt...
Null Object Pattern
A comprehensive guide to implementing and using the Null Object Pattern in Ruby to eliminate nil ...
Code Organization
Module Structure
Best practices for organizing code with modules and creating maintainable module hierarchies
Namespace Design
Designing effective namespaces to avoid conflicts and organize large Ruby applications
Service Objects
Implementing Service Objects to encapsulate business logic and keep models thin
Value Objects
Creating Value Objects for immutable domain concepts and improving code expressiveness
Error Handling
Exception Design
Designing custom exception hierarchies and handling errors effectively in Ruby applications
Fail Fast Principle
Implementing the Fail Fast principle to detect and handle errors early in Ruby code
Error Recovery
Strategies for graceful error recovery and maintaining application stability
Performance Patterns
Lazy Loading
Implementing lazy loading patterns to defer expensive operations and improve performance
Eager Loading
Using eager loading to prevent N+1 queries and optimize database access patterns
Database Optimization
Optimizing database queries and schema design for Ruby applications
Security Practices
Input Validation
Implementing robust input validation to prevent security vulnerabilities in Ruby applications
SQL Injection Prevention
Preventing SQL injection attacks through parameterized queries and safe database practices
XSS Prevention
Protecting against Cross-Site Scripting attacks with proper output encoding and sanitization
Authentication Patterns
Implementing secure authentication patterns and session management in Ruby applications
Coding Standards
Ruby Style Guide
Following community-accepted Ruby style guidelines for consistent and readable code
Naming Conventions
Ruby naming conventions for variables, methods, classes, and constants
Documentation Standards
Best practices for documenting Ruby code with YARD, RDoc, and inline comments
Testing Standards
Establishing testing standards and best practices for Ruby test suites
Ecosystem Integration
Web Frameworks
Rails Integration
Integrating Ruby with Rails framework for web application development
Sinatra Integration
Using Sinatra for lightweight Ruby web applications and microservices
Hanami Integration
Working with Hanami framework for modern Ruby web applications
Database Libraries
ActiveRecord
Using ActiveRecord ORM for database interactions in Ruby applications
Sequel
Working with Sequel database toolkit for Ruby applications
ROM
Using Ruby Object Mapper (ROM) for data persistence
Background Jobs
Sidekiq
Implementing background job processing with Sidekiq in Ruby applications
Resque
Using Resque for Redis-backed background job processing
Delayed Job
Working with Delayed Job for database-backed asynchronous processing
API Development
REST APIs
Building RESTful APIs with Ruby frameworks and best practices
GraphQL
Implementing GraphQL APIs in Ruby applications
JSON:API
Building JSON:API specification compliant APIs in Ruby
Deployment
Capistrano
Automating Ruby application deployment with Capistrano
Docker
Containerizing Ruby applications with Docker for deployment
Kubernetes
Deploying Ruby applications to Kubernetes clusters
Monitoring
Application Monitoring
Implementing application monitoring for Ruby applications
Error Tracking
Setting up error tracking and reporting in Ruby applications
Performance Monitoring
Monitoring and optimizing Ruby application performance