Better Standards

A guide to Ruby's stdlib and available alternatives.

Please note: The standard library was turned into gems, see for up-to-date information on all standard gems!

Standard Library Overview

Library Sources Description Alternatives
abbrev mri Small library that finds the shortest abbreviation to identify one string amongst many -
base64 mri Encodes and decodes strings to a Base64 representation. Implemented as a small wrapper around String#unpack -
continuation mri Deprecated library that adds the goto-like Kernel#callcc Concurrent Ruby, Fiber
coverage c mri Measures code coverage -
debug mri Command-line debugger byebug
digest c mri Provides common hash functions like MD5, SHA1, SHA2, or RIPEMD-160 OpenSSL::Digest
drb mri Distributed object system for Ruby -
English mri Readable aliases for special global variables -
erb mri Templating engine for Ruby erubis, erbse, erubi
expect mri Adds IO#expect, which can be used to wait for a specific pattern to be read -
fiber c mri Adds Fiber#transfer and Fiber#alive? -
find mri Finds all files in a given directory and its sub-directories `find .`.split($/)
io/nonblock c mri Allows to work with IO streams in a non-blocking way -
io/wait c mri Adds methods to wait until an IO stream becomes readable or writable -
mkmf mri Generates Makefiles for native C extensions -
monitor mri Monitors for multi-threaded code -
net/ftp mri Support for FTP (File Transfer Protocol) -
net/http mri Support for HTTP (Hypertext Transfer Protocol) http.rb, em-http-request, excon, httpclient
net/imap mri Support for IMAP (Internet Message Access Protocol) em-imap
nkf c mri Kanji encoding converter -
objspace c mri Adds more statistics methods to ObjectSpace -
open-uri mri Monkeypatches Kernel#open to support remote endpoints via net/http and net/ftp -
optparse mri Command-line option parser slop, optimist, clap, rationalist
pathname c mri Wraps File, FileTest, Dir, and FileUtils to ease working with file system paths path
prettyprint mri Better object formatting and inspection. Comes with the pp print debugging helper via require 'pp' wirb, hirb, awesome_print
profiler mri Measures which methods are called and how long each method takes to complete. Auto-start via require 'profile' ruby-prof, perftools.rb, method_profiler
pty c mri Manages pseudo terminals -
racc c mri
A YACC-like LALR(1) parser generator parslet, citrus, treetop
rbconfig - RbConfig is a Ruby constant that contains compile time information -
resolv mri Thread-aware DNS resolver. Will replace Socket's DNS via require 'resolve-replace' rubydns, net-dns, em-resolve-replace
rinda mri Support fot the Linda distributed computing paradigm in drb -
ripper c mri Ruby parser that creates a symbolic expression tree ruby_parser, parser
securerandom mri Provides crpytographical randomness from openssl or the OS -
set mri Data structure for unordered collections without duplicates. Implemented on top of Hash. Also comes with SortedSet for ordered collections. -
shellwords mri Escape and manipulate commands to be run in the shell -
socket c mri Support for unix- and network sockets -
syslog c mri Interface to the low-level syslog logger syslogger, log4r, lumberjack_syslog_device, yell-adapters-syslog
tempfile mri Simplifies OS independent creation of temporary files -
time mri Adds more methods to Time -
tmpdir mri Adds a Dir.mktmpdir method for creating temporary directories OS independently -
tsort mri Typological sorting using Tarjan’s algorithm, which finds strongly connected components in graphs -
un mri Utilities to replace common UNIX commands -
mri Adds a String#unicode_normalize method which normalizes unicode strings unf, unicode
weakref mri Explicitly allow objects to be garbage collected ref
Win32API c mri Let's you use Windows APIs, like calling functions in DLLs win32-api, ffi
win32ole c mri Windows OLE automation interface -

Default Gems

These libraries come as default Ruby gems, so that they can be updated independently from Ruby. See for more info.

Gem Sources Description Alternatives
benchmark mri
Benchmarking library benchmark-ips, benchmark-driver
bigdecimal c mri
Support for arbitrary-precision floating point decimal arithmetic -
bundler mri
Bundler is the local package manager for Ruby applications -
cgi mri
Support for CGI (Common Gateway Interface) rack
csv mri
Support for CSV (Comma-separated Values) smarter_csv
date c mri
The Date and DateTime classes -
dbm c mri
Support for DBM databases -
delegate mri
Provides three ways to delegate method calls forwardable
Patches error messages to suggest correct spelling of methods/classes/variables -
etc c mri
Access UNIX info from /etc -
fcntl c mri
Loads values from the OS' fcntl.h to be used for low-level file descriptor manipulation system calls with IO#fcntl and IO.sysopen -
fiddle c mri
Support for FFI (Foreign Function Interface) ffi
fileutils mri
Utilities for working with the file system -
forwardable mri
Provides a way to delegate method calls. Also see this overview of delegation in Ruby, which contains an example -
gdbm c mri
Support for GNU dbm databases -
getoptlong mri
GNU getopt_long() style command-line option parsing OptParse, slop, optimist, clap, rationalist
io/console c mri
Patches IO for simple and portable access to the console -
ipaddr mri
IP address manipulation ipaddress, ruby-ip
irb mri Interactive Ruby Console (REPL) ripl, pry, rib
json c mri
Support for JSON (JavaScript Object Notation) oj, yajl-ruby
logger mri
Logging utility log4r, lumberjack, yell, logging, micrologger
matrix mri
Support for matrices nmatrix
mutex_m mri
A mixin that makes any object behave like a mutex -
observer mri
Implementation of the observer pattern, a way to let interested other objects know o an object's updates microevent, signal_lamp
net/pop mri
Support for POP3 (Post Office Protocol) -
net/smtp mri
Support for SMTP (Simple Mail Transfer Protocol) -
open3 mri
Simple spawning of child processes open4
openssl c mri
Wraps OpenSSL for cryptographic functionality -
ostruct mri
Wrapper around Hash that lets you read and set attributes with a method API Hash, ostruct2
prime mri
Access to prime numbers and prime factorization -
pstore mri
Transactional file storage for Ruby objects -
psych c mri
Support for YAML (YAML Ain't Markup Language) -
rdoc mri
Ruby documentation generator yard
readline mri
If available, readline-ext will be loaded, or (Ruby-only) reline will be used -
readline-ext mri
Interface to GNU Readline and NetBSD Editline rb-readline, reline
reline mri
Ruby-only implementation of GNU Readline / NetBSD Editline rb-readline
rexml mri
Support for XML (Extensible Markup Language) nokogiri, oga
rss mri
Support for RSS (Rich Site Summary) and Atom -
Manages Ruby libraries. -
sdbm c mri
Support for SDBM databases -
singleton mri
Mixin for Ruby classes that should only have one instance -
stringio c mri
Makes strings behave like IO objects -
strscan c mri
Lexical string scanning -
timeout mri
Auto-terminates code blocks after the time limit is reached -
tracer mri
Outputs the code execution trace via Kernel#set_trace_func TracePoint
uri mri
URI/URL manipulation addressable,ruby-uriparser
webrick mri
HTTP server thin, unicorn, puma
yaml mri
Loads the psych yaml parser and sets YAML = Psych -
zlib c mri
Interface to the zlib compression library -

Bundled Gems

Gems that will be installed together with Ruby. See for more info.

Gem Description Alternatives
minitest Test/spec framework, comes with mocking and benchmark capabilities rspec
net-telnet Support for Telnet -
power_assert Debug tool that displays intermediate results of a method chain -
rake A Ruby task runner, inspired by make thor, boson
test-unit A xUnit family unit testing framework minitest, rspec
xmlrpc Remote Procedure Calls via XML and HTTP -

Something's wrong or missing? You can edit this list on GitHub!


More Idiosyncratic Ruby