Better Standards

A guide to Ruby's stdlib and available alternatives.

Standard Library Overview

Library Sources Description Alternatives
abbrev mri
rubysl
Small library that finds the shortest abbreviation to identify one string amongst many -
base64 mri
rubysl
Encodes and decodes strings to a Base64 representation. Implemented as a small wrapper around String#unpack -
benchmark mri
rubysl
Benchmarking library benchmark-ips, absolute_time
cgi mri
rubysl
Support for CGI (Common Gateway Interface) rack
cmath mri
rubysl
Trigonometric and transcendental functions for complex numbers -
continuation mri
rubysl
Deprecated library that adds the goto-like Kernel#callcc Concurrent Ruby, Fiber
coverage c mri
rubysl
Measures code coverage -
csv mri
rubysl
Support for CSV (Comma-separated Values) smarter_csv
date c mri
rubysl
The Date and DateTime classes -
dbm c mri
rubysl
Support for DBM databases -
debug mri
rubysl
Command-line debugger byebug
delegate mri
rubysl
Provides three ways to delegate method calls forwardable
digest c mri
rubysl
Provides common hash functions like MD5, SHA1, SHA2, or RIPEMD-160 OpenSSL::Digest
drb mri
rubysl
Distributed object system for Ruby -
e2mmap mri
rubysl
Abstraction arround exception handling -
English mri
rubysl
Readable aliases for special global variables -
erb mri
rubysl
Templating engine for Ruby erubis, erbse, erubi
etc c mri
rubysl
Access UNIX info from /etc -
expect mri
rubysl
Adds IO#expect, which can be used to wait for a specific pattern to be read -
fcntl c mri
rubysl
Loads values from the OS' fcntl.h to be used for low-level file descriptior manipulation system calls with IO#fcntl and IO.sysopen -
fiber c mri
rubysl
Adds Fiber#transfer and Fiber#alive? -
fiddle c mri
rubysl
Support for FFI (Foreign Function Interface) ffi
fileutils mri
rubysl
Utilities for working with the file system -
find mri
rubysl
Finds all files in a given directory and its sub-directories `find .`.split($/)
forwardable mri
rubysl
Provides a way to delegate method calls. Also see this overview of delegation in Ruby, which contains an example -
gdbm c mri
rubysl
Support for GNU dbm databases -
getoptlong mri
rubysl
GNU getopt_long() style command-line option parsing OptParse, slop, trollop, clap, rationalist
io/nonblock c mri
rubysl
Allows to work with IO streams in a non-blocking way -
io/wait c mri
rubysl
Adds methods to wait until an IO stream becomes readable or writable -
ipaddr mri
rubysl
IP address manipulation ipaddress, ruby-ip
irb mri
rubysl
Interactive Ruby Console (REPL) ripl, pry, rib
logger mri
rubysl
Logging utility log4r, lumberjack, yell, logging, micrologger
mathn c mri
rubysl
Deprecated library that extends math operations -
matrix mri
rubysl
Support for matrices nmatrix
mkmf mri
rubysl
Generates Makefiles for native C extensions -
monitor mri
rubysl
Monitors for multi-threaded code -
mutex_m mri
rubysl
A mixin that makes any object behave like a mutex -
net/ftp mri
rubysl
Support for FTP (File Transfer Protocol) -
net/http mri
rubysl
Support for HTTP (Hypertext Transfer Protocol) http.rb, em-http-request, excon, httpclient
net/imap mri
rubysl
Support for IMAP (Internet Message Access Protocol) em-imap
net/pop mri
rubysl
Support for POP3 (Post Office Protocol) -
net/smtp mri
rubysl
Support for SMTP (Simple Mail Transfer Protocol) -
nkf c mri
rubysl
Kanji encoding converter -
objspace c mri Adds more statistics methods to ObjectSpace -
observer mri
rubysl
Implementation of the observer pattern, a way to let interested other objects know o an objetc's updates microevent, signal_lamp
open-uri mri
rubysl
Monkeypatches Kernel#open to support remote endpoints via net/http and net/ftp -
open3 mri
rubysl
Simple spawning of child processes open4
optparse mri
rubysl
Command-line option parser slop, trollop, clap, rationalist
ostruct mri
rubysl
Wrapper around Hash that lets you read and set attributes with a method API Hash, ostruct2
pathname c mri
rubysl
Wraps File, FileTest, Dir, and FileUtils to ease working with file system paths path
prettyprint mri
rubysl
Better object formatting and inspection. Comes with the pp print debugging helper via require 'pp' wirb, hirb, awesome_print
prime mri
rubysl
Access to prime numbers and prime factorization -
profiler mri
rubysl
Measures which methods are called and how long each method takes to complete. Auto-start via require 'profile' ruby-prof, perftools.rb, method_profiler
pstore mri
rubysl
Transactional file storage for Ruby objects -
pty c mri
rubysl
Manages pseudo terminals -
racc c mri
gem
A YACC-like LALR(1) parser generator parslet, citrus, treetop
rbconfig - RbConfig is a Ruby constant that contains compile time information -
readline mri
rubysl
Interface to GNU Readline and NetBSD Editline rb-readline
resolv mri
rubysl
Thread-aware DNS resolver. Will replace Socket's DNS via require 'resolve-replace' rubydns, net-dns, em-resolve-replace
rexml mri
rubysl
Support for XML (Extensible Markup Language) nokogiri, oga
rinda mri
rubysl
Support fot the Linda distributed computing paradigm in drb -
ripper c mri
rubysl
Ruby parser that creates a symbolic expression tree ruby_parser, parser
rss mri
rubysl
Support for RSS (Rich Site Summary) and Atom -
rubygems
(auto-require)
mri
rubygems
Manages Ruby libraries. Can be required as ubygems -
scanf mri
rubysl
Pure-Ruby scanf implementation -
sdbm c mri
rubysl
Support for SDBM databases -
securerandom mri
rubysl
Provides crpytographical randomness from openssl or the OS -
set mri
rubysl
Data structure for unordered collections without duplicates. Implemented on top of Hash. Also comes with SortedSet for ordered collections. -
shell mri
rubysl
Provides a Ruby interface for interacting with the shell session
shellwords mri
rubysl
Escape and manipulate commads to be run in the shell -
singleton mri
rubysl
Mixin for Ruby classes that should only have one instance -
socket c mri
rubysl
Support for unix- and network sockets -
stringio c mri
rubysl
Makes strings behave like IO objects -
strscan c mri
rubysl
Lexical string scanning -
sync mri
rubysl
Two-phase lock with a counter for multi-threaded code -
syslog c mri
rubysl
Interface to the low-level syslog logger syslogger, log4r, lumberjack_syslog_device, yell-adapters-syslog
tempfile mri
rubysl
Simplifies OS independent creation of temporary files -
thwait mri
rubysl
Waits for threads to finish thread
time mri
rubysl
Adds more methods to Time -
timeout mri
rubysl
Auto-terminates code blocks after the time limit is reached -
tmpdir mri
rubysl
Adds a Dir.mktmpdir method for creating temporary directories OS independently -
tracer mri
rubysl
Outputs the code execution trace via Kernel#set_trace_func TracePoint
tsort mri
rubysl
Topological sorting using Tarjan’s algorithm, which finds strongly connected components in graphs -
un mri
rubysl
Utilities to replace common UNIX commands -
unicode_normalize
(auto-require)
mri
rubysl
Adds a String#unicode_normalize method which normalizes unicode strings unf, unicode
uri mri
rubysl
URI/URL manipulation adressable,ruby-uriparser
weakref mri
rubysl
Explicitely allow objects to be garbage collected ref
webrick mri
rubysl
HTTP server thin, unicorn, puma
Win32API c mri
rubysl
Let's you use Windows APIs, like calling functions in DLLs win32-api, ffi
win32ole c mri
rubysl
Windows OLE automation interface -
yaml mri
rubysl
Loads the psych yaml parser and sets YAML = Psych -
zlib c mri
rubysl
Interface to the zlib compression library -

Default Gems

Standard Ruby extensions that come as Ruby gems, so that they can be updated independently from Ruby. The second column is the version of the that is included in Ruby 2.4.

Gem 2.4 Sources Description Alternatives
bigdecimal c 1.3.0 mri
rubysl
gem
Support for arbitrary-precision floating point decimal arithmetic -
io/console c 0.4.6 mri
rubysl
gem
Patches IO for simple and portable access to the console -
json c 2.0.2 mri
gem
Support for JSON (JavaScript Object Notation) oj, yajl-ruby
openssl c 2.0.2 mri
rubysl
gem
Wraps OpenSSL for cryptographic functionality -
psych c 2.2.2 mri
gem
Support for YAML (YAML Ain't Markup Language) -
rdoc 5.0.0 mri
gem
Ruby documentation generator yard

Bundled Gems

Gems that will be installed together with Ruby. Columns 2-4 refer to the respective gem version bundled with a specific version of Ruby.

Gem 2.4 2.3 2.2 Description Alternatives
did_you_mean
(auto-require)
1.1.0 1.0.0 - Patches error messages to suggest correct spelling of methods/classes/variables -
minitest 5.10.1 5.8.3 5.4.3 Test/spec framework, comes with mocking and benchmark capabilities rspec
net-telnet 0.1.1 0.1.1 - Support for Telnet -
power_assert 0.4.1 0.2.6 0.2.2 Debug tool that displays intermediate results of a method chain -
rake 12.0.0 10.4.2 - A Ruby task runner, inspired by make thor, boson
test-unit 3.2.3 3.1.5 3.0.8 A xUnit family unit testing framework minitest, rspec
xmlrpc 0.2.1 - - Remote Procedure Calls via XML and HTTP -

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

Resources

More Idiosyncratic Ruby