Read the Ruby docs. Run the examples.
Core classes, the standard library and default gems, with each example one click from a playground that runs Ruby in your browser.
Ruby 4.0 1,246 classes & modules 11,536 methods 7 versions, 3.0–4.1
example.rbRuby 4.0
puts "Hello Ruby #{RUBY_VERSION}!" [1, 2, 3].map { _1 ** 2 } #=> [1, 4, 9] # open the playground to run your own →
Run in Playground
Runs on WebAssembly. Nothing to install.
Documentation
Array
Ordered, integer-indexed collection of any objects.
114 instance methods, 3 class methods
Hash
Ordered key-value map with default values and compare-by-identity.
72 instance methods, 5 class methods
Integer
Arbitrary-precision whole numbers. Bit operations and iteration.
66 instance methods, 2 class methods
Kernel
Global functions every object has:
puts, require, raise, loop.
81 instance methods, 3 class methods
String
Mutable sequence of bytes with an encoding. Slicing, substitution, case, and Unicode.
137 instance methods, 3 class methods
Date
Calendar dates without time. Civil, Julian, and ISO week forms.
68 instance methods, 33 class methods
Enumerable
Mixin that gives any class with each the full set of search, sort, and loop methods.
61 instance methods
JSON
Parse and generate JSON. Ships as a default gem.
10 instance methods, 5 class methods
Object
Default root. Equality, inspection, freezing, and message sending.
41 instance methods, 1 class methods
Range
Interval from a start to an end, endless or beginless.
30 instance methods, 2 class methods
Regexp
Regular-expression patterns. Match data, named captures, and flags.
20 instance methods, 11 class methods
Time
Point in time with zone. Parsing, formatting, and arithmetic.
65 instance methods, 16 class methods
BasicObject
Blank-slate root above Object. Almost no methods, for proxies and domain-specific languages.
12 instance methods, 1 class methods
Float
64-bit floating-point numbers. Rounding, not-a-number, and infinity.
47 instance methods
Numeric
Base class of every number. Comparison, coercion, and stepping.
46 instance methods
Symbol
Immutable, interned names. One object per spelling.
31 instance methods, 2 class methods
Addrinfo
The Addrinfo class maps struct addrinfo to ruby.
42 instance methods, 7 class methods
ARGF
The files named on the command line, read as one stream.
50 instance methods
ArgumentError
Raised when the arguments are wrong and there isn’t a more specific Exception class.
0 instance methods
BasicSocket
BasicSocket is the super class for all the Socket classes.
20 instance methods, 3 class methods
BigDecimal
Arbitrary-precision decimal numbers, from the bigdecimal gem.
2 instance methods, 1 class methods
Binding
A captured execution context. Local variables, self, and eval.
10 instance methods
CGI
Since Ruby 4.0, only the escape helpers from QueueError
The exception class which will be raised when pushing into a closed Queue.
0 instance methods
CGI::Escape. The rest of CGI left the standard library.
0 instance methods
Closed
Comparable
Mixin that derives the ordering operators from Extensions
Namespace for the RubyGems patches to core classes.
0 instance methods
Coverage
Coverage provides coverage measurement feature for Ruby.
0 instance methods, 10 class methods
Data
Immutable value class with named members, defined in one line.
10 instance methods, 3 class methods
DateTime
A subclass of Date that easily handles date, hour, minute, second, and offset.
22 instance methods, 17 class methods
Delegator
Base class that passes method calls on to a wrapped object. See
<=>.
7 instance methods
Complex
Complex numbers in rectangular or polar form.
39 instance methods, 4 class methods
Continuation
Saved point of execution from Kernel#callcc, after require "continuation".
2 instance methods
CoreSimpleDelegator and DelegateClass.
17 instance methods, 1 class methods
CGI::Escape
Web-related escape/unescape functionality.
15 instance methods
CGI::EscapeExt
Fast C versions of the Extensions::TCPSocketExt
RubyGems patch that prepends a faster connect to Extensions::TCPSocketExt::Initializer
Error
Raised for an invalid date or time.
0 instance methods
DidYouMean::ClassNameChecker
Suggests similar constant names for a YouMean::ClassNameChecker::ClassName
A candidate constant name with its namespace.
1 instance methods, 1 class methods
DidYouMean::Correctable
Mixin that adds "Did you mean?" suggestions to an error message.
5 instance methods
CGI escape and unescape methods.
8 instance methods
CoreTCPSocket.
0 instance methods, 1 class methods
CoreTCPSocket.new that tries each resolved address and keeps the first to connect.
0 instance methods, 1 class methods
Date::NameError.
3 instance methods, 1 class methods
Did
DidYouMean::Formatter
The DidYouMean::Formatter is the basic, default formatter for the gem.
1 instance methods, 1 class methods
DidYouMean::Jaro
Jaro similarity between two strings.
1 instance methods
DidYouMean::JaroWinkler
Jaro-Winkler similarity, which favours a shared prefix.
1 instance methods
DidYouMean::KeyErrorChecker
Suggests similar keys for a YouMean::MethodNameChecker
Suggests similar method names for a YouMean::NameErrorCheckers
Picks the checker for a YouMean::NullChecker
The checker that suggests nothing.
1 instance methods, 1 class methods
DidYouMean::PatternKeyNameChecker
Suggests similar keys for a
KeyError.
3 instance methods, 1 class methods
DidNoMethodError.
3 instance methods, 1 class methods
DidNameError, by constant or by variable name.
0 instance methods, 1 class methods
DidNoMatchingPatternKeyError.
3 instance methods, 1 class methods