CrackedRuby logo

CrackedRuby

Ruby Language Documentation

Ruby Language Fundamentals

Basic Syntax and Structure

1.1.1 Character Sets 1.1.2 Line Orientation and Statement Termination 1.1.3 Code Blocks 1.1.4 Embedded Documentation (=begin/=end) 1.1.5 Reserved Keywords and Identifiers 1.1.6 Language Encoding and Magic Comments 1.1.7 Comments 1.1.8 Indentation

Variables and Constants

1.2.1 Local Variables 1.2.2 Instance Variables (@variable) 1.2.3 Class Variables (@@variable) 1.2.4 Global Variables ($variable) 1.2.5 Constants and Namespacing 1.2.6 Pseudo Variables (self, nil, true, false) 1.2.7 Variable Scope and Binding 1.2.8 Parallel Assignment 1.2.9 Splat Operators in Assignment

Data Types and Literals

1.3.1 Numeric Literals (Integer, Float, Binary, Octal, Hex) 1.3.2 String Literals 1.3.3 Symbol Literals 1.3.4 Array Literals 1.3.5 Hash Literals 1.3.6 Range Literals 1.3.7 Regular Expression Literals 1.3.8 Here Documents 1.3.9 Percent Notation 1.3.10 String Interpolation

Operators

1.4.1 Arithmetic Operators 1.4.2 Comparison and Equality Operators 1.4.3 Logical Operators (and/or vs &&/||) 1.4.4 Bitwise Operators 1.4.5 Range Operators 1.4.6 Assignment Operators 1.4.7 Splat and Double Splat Operators 1.4.8 Safe Navigation Operator (&.) 1.4.9 Pattern Matching Operators 1.4.10 Operator Precedence and Associativity 1.4.11 Rightward Assignment Operator (=>)

Control Flow

1.5.1 if/elsif/else Statements 1.5.2 unless Statements 1.5.3 case/when Expressions 1.5.4 Modifier if and unless 1.5.5 Ternary Operator 1.5.6 Pattern Matching with case/in 1.5.7 Pattern Matching in Depth 1.5.8 Pattern Matching with Find Patterns 1.5.9 Pin Operator in Pattern Matching

Loops and Iterators

1.6.1 while and until Loops 1.6.2 for Loops 1.6.3 loop Method 1.6.4 times, upto, downto Methods 1.6.5 each and Enumerator Methods 1.6.6 break, next, redo, retry 1.6.7 Infinite Loops and Loop Control

Methods

1.7.1 Method Definition and Syntax 1.7.2 Required and Optional Parameters 1.7.3 Default Parameter Values 1.7.4 Variable Arguments (*args) 1.7.5 Keyword Arguments 1.7.6 Block Parameters (&block) 1.7.7 Method Return Values 1.7.8 Method Visibility (public, protected, private) 1.7.9 Method Aliases and Undef 1.7.10 Operator Methods 1.7.11 Endless Method Definition 1.7.12 Method Definition Styles Comparison

Blocks, Procs, and Lambdas

1.8.1 Block Syntax and Usage 1.8.2 Block Parameters and Return Values 1.8.3 yield and block_given? 1.8.4 Proc Objects 1.8.5 Lambda Functions 1.8.6 Proc vs Lambda Differences 1.8.7 Closures and Lexical Scope 1.8.8 Block to Proc Conversion 1.8.9 Currying and Partial Application 1.8.10 Numbered Block Parameters (_1, _2) 1.8.11 Anonymous Block Arguments Best Practices

Classes and Objects

1.9.1 Class Definition and Instantiation 1.9.2 Instance Variables and Methods 1.9.3 Class Variables and Methods 1.9.4 Constructors (initialize) 1.9.5 Inheritance and super 1.9.6 Method Overriding 1.9.7 Access Control 1.9.8 attr_accessor, attr_reader, attr_writer 1.9.9 Class Constants 1.9.10 Class Instance Variables

Modules and Mixins

1.10.1 Module Definition 1.10.2 Module Methods 1.10.3 include Method 1.10.4 extend Method 1.10.5 prepend Method 1.10.6 Module Constants 1.10.7 Namespacing with Modules 1.10.8 Method Lookup Chain 1.10.9 Module Functions 1.10.10 Refinements 1.10.11 Nesting Behavior

Exception Handling

1.11.1 begin/rescue/ensure/end 1.11.2 raise and fail 1.11.3 Exception Classes Hierarchy 1.11.4 Custom Exception Classes 1.11.5 rescue Modifiers 1.11.6 retry and Exception Handling 1.11.7 throw and catch 1.11.8 Exception Backtrace

Core Built-in Classes

Numeric Classes

2.1.1 Integer Class and Methods 2.1.2 Float Class and Precision 2.1.3 Rational Numbers 2.1.4 Complex Numbers 2.1.5 Numeric Base Class 2.1.6 BigDecimal for Arbitrary Precision 2.1.7 Numeric Coercion 2.1.8 Mathematical Operations

String Class

2.2.1 String Creation and Literals 2.2.2 String Concatenation 2.2.3 String Comparison 2.2.4 String Searching and Matching 2.2.5 String Substitution (sub, gsub) 2.2.6 String Splitting and Joining 2.2.7 String Case Conversion 2.2.8 String Encoding 2.2.9 String Formatting 2.2.10 String Iteration 2.2.11 String Freezing and Mutability

Symbol Class

2.3.1 Symbol Creation and Usage 2.3.2 Symbol vs String 2.3.3 Symbol Methods 2.3.4 Symbol to Proc

Array Class

2.4.1 Array Creation and Initialization 2.4.2 Array Access and Assignment 2.4.3 Array Iteration Methods 2.4.4 Array Transformation (map, select, reject) 2.4.5 Array Sorting and Ordering 2.4.6 Array Set Operations 2.4.7 Array Flattening and Transposition 2.4.8 Array Compaction 2.4.9 Array fetch_values 2.4.10 Array Destructuring 2.4.11 Array Uniqueness

Hash Class

2.5.1 Hash Creation and Initialization 2.5.2 Hash Access and Assignment 2.5.3 Hash Iteration 2.5.4 Hash Merging and Updating 2.5.5 Hash Transformation 2.5.6 Hash Default Values 2.5.7 Hash Compaction 2.5.8 Hash to Proc 2.5.9 Hash Capacity 2.5.10 Hash Value Omission 2.5.11 Hash Shorthand Syntax

Range Class

2.6.1 Range Creation (Inclusive/Exclusive) 2.6.2 Range Iteration 2.6.3 Range Testing (cover?, include?) 2.6.4 Range to Array Conversion 2.6.5 Endless and Beginless Ranges 2.6.6 Range step with Custom Objects

Regexp and MatchData

2.7.1 Regular Expression Syntax 2.7.2 Pattern Matching Methods 2.7.3 Capture Groups 2.7.4 Named Captures 2.7.5 Regexp Options and Modifiers 2.7.6 MatchData Methods 2.7.7 bytebegin and byteend 2.7.8 Regexp Timeout

Time and Date Classes

2.8.1 Time Class and Creation 2.8.2 Time Arithmetic 2.8.3 Time Formatting (strftime) 2.8.4 Time Parsing 2.8.5 Time Zones 2.8.6 Date Class 2.8.7 DateTime Class 2.8.8 xmlschema and iso8601

File and IO Classes

2.9.1 File Operations 2.9.2 File Reading and Writing 2.9.3 File Permissions 2.9.4 IO Class Methods 2.9.5 STDIN, STDOUT, STDERR 2.9.6 Dir Class 2.9.7 Pathname Class 2.9.8 File.stat and File Testing

Process and System

2.10.1 Process Creation and Management 2.10.2 Process Communication 2.10.3 Signal Handling 2.10.4 System Calls

Data Class

2.11.1 Data Class Introduction 2.11.2 Data vs Struct Comparison 2.11.3 Data Class Pattern Matching

Core Modules

Standard Library

Data Structures

4.1.1 Set and SortedSet 4.1.2 Queue and SizedQueue 4.1.3 Stack Implementation 4.1.4 OpenStruct 4.1.5 Struct Class

Network Programming

4.2.1 Net::HTTP 4.2.2 Net::FTP 4.2.3 Net::SMTP 4.2.4 Net::POP3 4.2.5 Net::IMAP 4.2.6 Socket Programming 4.2.7 TCPSocket and UDPSocket 4.2.8 URI Module 4.2.9 OpenURI 4.2.10 Happy Eyeballs v2

Data Formats

4.3.1 JSON Parsing and Generation 4.3.2 YAML Processing 4.3.3 CSV Reading and Writing 4.3.4 XML/REXML 4.3.5 RSS/Atom Feeds 4.3.6 Base64 Encoding

Database Interfaces

4.4.1 PStore 4.4.2 DBM 4.4.3 GDBM 4.4.4 SDBM

Security and Cryptography

4.5.1 OpenSSL 4.5.2 Digest Algorithms 4.5.3 SecureRandom 4.5.4 HMAC 4.5.5 Public Key Cryptography 4.5.6 SSL/TLS

File Utilities

4.6.1 FileUtils 4.6.2 Find Module 4.6.3 Tempfile 4.6.4 Pathname 4.6.5 FileTest

Text Processing

4.7.1 StringIO 4.7.2 StringScanner 4.7.3 ERB Templates 4.7.4 Scanf 4.7.5 Format Strings

System Utilities

4.8.1 OptionParser 4.8.2 Logger 4.8.3 Syslog 4.8.4 Etc Module 4.8.5 GetoptLong 4.8.6 Shellwords

Web and CGI

4.9.1 CGI Module 4.9.2 WEBrick Server 4.9.3 CGI Sessions 4.9.4 CGI Cookies

Compression

4.10.1 Zlib 4.10.2 GZip 4.10.3 Tar Archives

Debugging Tools

4.11.1 Debug Gem 4.11.2 Tracer 4.11.3 Profile 4.11.4 Debugger API 4.11.5 Debug Gem Commands 4.11.6 Remote Debugging with Debug Gem 4.11.7 Debug Gem Configuration

Date and Time Extensions

4.12.1 Date Calculations 4.12.2 Chronic Duration

Internationalization

4.13.1 Encoding Classes 4.13.2 Encoding Conversion 4.13.3 Unicode Support

Metaprogramming

Concurrency and Parallelism

Ruby 3.4 Specific Features