Ruby Index

This page is a topical index to Ruby classes and mixins.


There are several sets of online API documentation for Ruby. All of these sites are mechanically-generated, so they depend on extracted comments for class descriptions, etc. So, if the Ruby source code has poor (or no) overview documentation, the online API pages will be similarly constrained. Also, none of the sites we've found provide topic-based indexing.

The best resource we have found so far ( is nicely formatted and each page has a unique URL, but it still isn't convenient for skimming by a blind programmer. So, we have created an annotated topical index, adapting and supplementing the "official" text for our own descriptions. That said, it's only a hand-edited first cut. Comments and suggestions welcome!

Topical Index

Classes and Objects

Contains: BasicObject, Class, Comparable, Kernel, Method, Module, Object, ObjectSpace, ObjectSpace::WeakMap, Struct

BasicObject (C)

BasicObject, an explicit blank class, is the parent of all classes in Ruby.

Class (C)

Classes in Ruby are first-class objects - each is an instance of class Class.

Comparable (M)

The Comparable mixin is used by classes whose objects may be ordered.

Kernel (M)

The Kernel module is included by class Object, so its methods are available in every Ruby object.

Method (C)

The Method class provides ways to introspect, manipulate, and use Ruby methods.

Module (C)

A Module is a collection of methods and constants.

Object (C)

Object is the default root of all Ruby objects. Object inherits from BasicObject, which allows creating alternate object hierarchies. Methods on Object are available to all classes unless explicitly overridden.

ObjectSpace (M)

The ObjectSpace module contains a number of routines that interact with the garbage collection facility and allow you to traverse all living objects with an iterator.

ObjectSpace::WeakMap (C)

An ObjectSpace::WeakMap object holds references to any objects, but those objects can get garbage collected.

Struct (C)

A Struct is similar to a Class, but may be more convenient for some purposes, e.g.: defining internal class data, temporary data structures, testing stubs. For more information, see "The simple but powerful Ruby Struct".

Data - Scalars

Contains: Bignum, Complex, Complex::compatible, FalseClass, Fixnum, Float, Integer, Math, NilClass, Numeric, Range, Rational, Rational::compatible, TrueClass

Bignum (C)

Bignum objects hold integers outside the range of Fixnum.

Complex (C)

A complex number can be represented as a pair of real numbers (a,b), where a is the real part and b is the imaginary part.

Complex::compatible (C)

This class appears to be a workaround for a backwards-compatibility issue in Marshal. See "What's about Rational::compatible and Complex::compatible?" for details.

Fixnum (C)

Holds Integer values that can be represented in a native machine word (minus 1 bit).

FalseClass (C)

The global value false is the only instance of class FalseClass. It represents a logically false value in boolean expressions.

Float (C)

Float objects represent inexact real numbers, using the native architecture's double-precision floating point representation.

Integer (C)

This class is the basis for the two concrete classes that hold whole numbers, Bignum and Fixnum.

Math (M)

The Math module contains module functions for basic trigonometric and transcendental functions.

NilClass (C)

The global value nil is the only instance of class NilClass. It is a special Ruby data type that means "nothing".

Numeric (C)

Numeric is the class from which all higher-level numeric classes should inherit.

Range (C)

A Range represents an interval - a set of values with a beginning and an end.

Rational (C)

A rational number can be represented as a pair of integer numbers (a,b), where a is the numerator and b (always positive) is the denominator.

Rational::compatible (C)

This class appears to be a workaround for a backwards-compatibility issue in Marshal. See "What's about Rational::compatible and Complex::compatible?" for details.

TrueClass (C)

The global value true is the only instance of class TrueClass. It represents a logically true value in boolean expressions.

Data - Strings

Contains: Encoding, Encoding::Converter, MatchData, Regexp, String, Symbol

Encoding (C)

An Encoding instance represents a character encoding usable in Ruby. It is defined as a constant under the Encoding namespace. It has a name and optionally, aliases:

Encoding::Converter (C)

This class contains constants and methods for converting character encodings.

MatchData (C)

MatchData encapsulates the results of a regular expression pattern match.

Regexp (C)

A Regexp holds a regular expression, used to match a pattern against strings.

String (C)

A String object holds and manipulates an arbitrary sequence of bytes, typically representing characters.

Symbol (C)

Symbol objects represent names and some strings inside the Ruby interpreter. The same Symbol object will be created for a given name or string for the duration of a program's execution.

Data - Structures

Contains: Array, Data, Hash

Array (C)

Arrays are ordered, integer-indexed collections of any object.

Data (C)

This is a recommended base class for C extensions using Data_Make_Struct or Data_Wrap_Struct.

Hash (C)

A Hash is a dictionary-like collection of unique keys and their values. Also called associative arrays, they are similar to Arrays, but where an Array uses integers as its index, a Hash allows you to use any object type.


Contains: Enumerable, Enumerator, Enumerator::Generator, Enumerator::Lazy, Enumerator::Yielder

Enumerable (M)

The Enumerable mixin provides collection classes with several traversal and searching methods, and with the ability to sort.

Enumerator (C)

The Enumerator class supports internal and external iteration, in either greedy (default) or lazy mode. For details, see "Ruby 2.0 Works Hard So You Can Be Lazy".

Enumerator::Generator (C)

This subclass supports block-based generation of enumerators.

Enumerator::Lazy (C)

This subclass supports creation and access of lazy enumerators.

Enumerator::Yielder (C)

This subclass provides an alternative way to yield from a block. For details, see Help understanding yield and enumerators in Ruby.


Contains: ArgumentError, ClosedQueueError, EOFError, Encoding::CompatibilityError, Encoding::ConverterNotFoundError, Encoding::InvalidByteSequenceError, Encoding::UndefinedConversionError, EncodingError, Errno, Exception, FiberError, FloatDomainError, IO::EAGAINWaitReadable, IO::EINPROGRESSWaitReadable, IO::EINPROGRESSWaitWritable, IO::EWOULDBLOCKWaitReadable, IO::EWOULDBLOCKWaitWritable, IOError, IndexError, Interrupt, KeyError, LoadError, LocalJumpError, Math::DomainError, NameError, NoMemoryError, NoMethodError, NotImplementedError, RangeError, RegexpError, RuntimeError, ScriptError, SecurityError, Signal, SignalException, SystemExit, StandardError, StopIteration, SyntaxError, SystemCallError, SystemStackError, ThreadError, TypeError, UncaughtThrowError, ZeroDivisionError, fatal

ArgumentError (C)

Raised when the arguments are wrong and there isn't a more specific Exception class.

ClosedQueueError (C)

Raised when the referenced Queue object is closed.

EOFError (C)

Raised by some IO operations when reaching the end of file.

Encoding::CompatibilityError (C)

Raised by Encoding and String methods when the source encoding is incompatible with the target encoding.

Encoding::ConverterNotFoundError (C)

Raised by transcoding methods when a named encoding does not correspond with a known converter.

Encoding::InvalidByteSequenceError (C)

Raised by Encoding and String methods when the string being transcoded contains a byte that is invalid for either the source or target encoding.

Encoding::UndefinedConversionError (C)

Raised by Encoding and String methods when a transcoding operation fails.

EncodingError (C)

EncodingError is the base class for encoding errors.

Errno (M)

Module Errno is created dynamically to map operating system errors to Ruby classes, with each error number generating its own subclass of SystemCallError.

Exception (C)

Descendants of class Exception are used to communicate between Kernel#raise and rescue statements in begin ... end blocks. Exception objects carry information about the exception – its type (the exception’s class name), an optional descriptive string, and optional traceback information. Exception subclasses may add additional information like NameError#name.

FiberError (C)

Raised when an invalid operation is attempted on a Fiber, in particular when attempting to call/resume a dead fiber, attempting to yield from the root fiber, or calling a fiber across threads.

FloatDomainError (C)

Raised when attempting to convert special float values (in particular infinite or NaN) to numerical classes which don't support them.

IO::EAGAINWaitReadable (C)










IOError (C)

Raised when an IO operation fails.

IndexError (C)

Raised when the given index is invalid.

Interrupt (C)

Raised when the interrupt signal is received, typically because the user pressed on Control-C (on most POSIX platforms).

KeyError (C)

Raised when the specified key is not found. It is a subclass of IndexError.

LoadError (C)

Raised when a file required (a Ruby script, extension library, ...) fails to load.

LocalJumpError (C)

Raised when Ruby can't yield as requested.

Math::DomainError (C)

Raised when a mathematical function is evaluated outside of its domain of definition.

NameError (C)

Raised when a given name is invalid or undefined.

NoMemoryError (C)

Raised when memory allocation fails.

NoMethodError (C)

Raised when a method is called on a receiver which doesn't have it defined and also fails to respond with method_missing.

NotImplementedError (C)

Raised when a feature is not implemented on the current platform.

RangeError (C)

Raised when a given numerical value is out of range.

RegexpError (C)

Raised when given an invalid regular expression.

RuntimeError (C)

A generic error class, raised when an invalid operation is attempted.

ScriptError (C)

ScriptError is the superclass for errors raised when a script can not be executed because of a LoadError, NotImplementedError, or SyntaxError.

SecurityError (C)

Raised when attempting a potential unsafe operation, typically when the $SAFE level is raised above 0.

Signal (M)

Support for handling of operating system signals.

SignalException (C)

Raised when a signal is received.

SystemExit (C)

Raised by exit to initiate the termination of the script.

StandardError (C)

The most standard error types are subclasses of StandardError. A rescue clause without an explicit Exception class will rescue all StandardErrors (and only those).

StopIteration (C)

Raised to stop the iteration, in particular by Enumerator#next.

SyntaxError (C)

Raised when encountering Ruby code that has invalid syntax.

SystemCallError (C)

SystemCallError is the base class for all low-level, platform-dependent errors.

SystemStackError (C)

Raised in case of a stack overflow.

ThreadError (C)

Raised when an invalid operation is attempted on a thread.

TypeError (C)

Raised when encountering an object that is not of the expected type.

UncaughtThrowError (C)

Raised when throw is called with a tag which does not have a corresponding catch block.

ZeroDivisionError (C)

Raised when attempting to divide an integer by 0.

fatal (C)

fatal is an Exception that is raised when Ruby has encountered a fatal error and must exit.


Contains: Binding, ConditionVariable, Continuation, Fiber, Proc, Process, Process::GID, Process::Status, Process::Sys, Process::UID, Process::Waiter, Queue, SizedQueue, Thread, Thread::Backtrace. Thread::Backtrace::Location, Thread::Mutex, ThreadGroup

Binding (C)

Objects of class Binding encapsulate and retain the execution context at some particular point in the code's operation.

ConditionVariable (C)

ConditionVariable objects augment class Mutex. Using condition variables, it is possible to suspend while in the middle of a critical section until a resource becomes available.

Continuation (C)

Continuation objects hold a return address and execution context, allowing a nonlocal return to the end of the callcc block from anywhere within a program.

Fiber (C)

Fibers are primitives for implementing light weight cooperative concurrency in Ruby. Basically they are a means of creating code blocks that can be paused and resumed, much like threads. The main difference is that they are never preempted, so the scheduling must be done by the programmer.

Proc (C)

Proc objects are blocks of code that have been bound to a set of local variables. Once bound, the code may be called in different contexts and still access those variables.

Process (M)

The Process class contains constants and methods for controlling and introspecting processes.

Process::GID (M)

Process::GID contains a collection of module functions which can be used to portably get, set, and switch the current process's real, effective, and saved group IDs.

Process::Status (C)

Process::Status encapsulates information on the status of a running or terminated system process.

Process::Sys (M)

The Process::Sys module contains UID and GID functions which provide direct bindings to the system calls of the same names instead of the more-portable versions of the same functionality found in the Process, Process::UID, and Process::GID modules.

Process::UID (M)

The Process::UID module contains a collection of module functions which can be used to portably get, set, and switch the current process's real, effective, and saved user IDs.

Process::Waiter (C)


Queue (C)

This class provides a way to synchronize communication between threads.

SizedQueue (C)

This class represents queues of specified size capacity.

Thread (C)

Threads are the Ruby implementation for a concurrent programming model.

Thread::Backtrace (C)


Thread::Backtrace::Location (C)

An object representation of a stack frame, initialized by Kernel#caller_locations.

Thread::Mutex (C)

Methods for creating and using Mutex (mutual exclusion).

ThreadGroup (C)

ThreadGroup provides a means of keeping track of a number of threads as a group.


Contains: Dir, File, File::Constants, File::Stat, FileTest, IO, IO::WaitReadable, IO::WaitWritable, Marshal

Dir (C)

A Dir is a directory stream, representing a directory in the underlying file system.

File (C)

A File (closely associated with class IO) is an abstraction of any file object that is accessible by the program.

File::Constants (C)

The File::Constants class provides file-related constants.

File::Stat (C)

Objects of class File::Stat encapsulate common status information for File objects.

FileTest (M)

FileTest implements file test operations similar to those used in File::Stat.

IO (C)

The IO class is the basis for all input and output in Ruby.

IO::WaitReadable (M)


IO::WaitWritable (M)


Marshal (M)

The marshaling library converts collections of Ruby objects into a byte stream, allowing them to be stored outside the currently active script. This data may subsequently be read and the original objects reconstituted.

Virtual Machine

Contains: GC, GC::Profiler, RubyVM, RubyVM::Env, RubyVM::InstructionSequence

GC (M)

The GC module provides an interface to Ruby’s mark and sweep garbage collection mechanism.

GC::Profiler (M)

The GC profiler provides access to information on GC runs including time, length, and object space size.

RubyVM (C)


RubyVM::Env (C)


RubyVM::InstructionSequence (C)

The InstructionSequence class represents a compiled sequence of instructions for the Ruby Virtual Machine.


Contains: ENV, Random, Random::Formatter, Time, TracePoint, UnboundMethod, unknown


ENV is a hash-like accessor for environment variables.

Random (C)

Random provides an interface to Ruby's pseudo-random number generator, or PRNG.

Random::Formatter (C)


Time (C)

The Time class provides an abstraction for dates and times.

TracePoint (C)

A class that provides the functionality of Kernel#set_trace_func in a nice, Object-Oriented API.

UnboundMethod (C)

Support for method objects that are not associated with a particular object.

This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r14 - 19 Oct 2016, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email