Ruby comes with a set of 23 gems bundled with it (as of version 2.5.1). I decided that it would be a good idea to learn what they all do since they are all available by default in any Ruby project. In this post, I will describe what they all do, as well as provide links to each of their RubyGems.org pages.
The big decimal gem provides “arbitrary-precision floating point decimal arithmetic”. Ruby itself provides support for arbitrary precision integer arithmetic. BigDecimal provides a similar level of support for very accurate or very large floating point numbers. This arithmetic is useful because it provides the answer people expect, as opposed to normal binary floating point arithmetic, which can have errors.
CMath provides “trigonometric and transcendental functions for complex numbers”. It accepts integers, floating-point numbers, and complex numbers.
CSV provides an interface with CSV(comma-separated-values) files and data.
Date provides a subclass Object that helps handle dates. Date objects are immutable and have various methods, such as year, mon which returns the month, and mday which provides the day of the month.
dbm wraps the Database Manager Library. DBM databases are key-value data stores, similar to a Ruby hash. Keys and values must be strings.
etc provides access to information stored in the
/etc directory of a UNIX system. It allows you to access information in the
/etc/group files as well as the
Fcntl loads constants defined in the systems fcntl.h C header file.
Fiddle is a libffi wrapper for Ruby. libffi stands for Foreign Function Interface library. A foreign function is a name for an interface that allows code written in one language to call code written in a different language. libffi is described as a way to “build a bridge between interpreted and natively compiled code”.
FileUtils provides file utility methods, which provide functionalities such as copying, moving, and removing.
GDBM is a Ruby extension for the GNU database manager. The GNU database manager is a library for simple databases consisting of key-value pairs. The database can be accessed by both reader and writer methods
IO-Console “adds console capabilities to IO instances.”
IPAddr gives you methods to manipulate an IP address in both IPv4 and IPv6 versions. It provides methods such as IN6FORMAT, which formats a string as an IPv6 address, and regex methods to parse IPv4 and IPv6 addresses.
json provides a JSON implementation written in C. It allows you to parse and generate JSON.
openssl wraps the OpenSSL library and provides methods to create, export, and load OpenSSL keys.
Psych is a “YAML parser and emitter”. YAML is a data serialization language that is often used as a way to store configuration files. Psych wraps libyaml, which is a YAML parser and emitter library.
RDoc “produces HTML and command-line documentation for Ruby project”. It provides various formatting and parsing methods.
rubygems-update seems to be a way to update your other Ruby gems. Little information is available related to it.
scanf is an implementation of the C function scanf, which has been modified to work with Ruby. Scanf scans an input according to a format and returns an array of matches. The format can also contain conversion specifiers which tell the function what type each particular matched substring should be converted to.
SDBM provides a key-value store. The keys and values must be strings. It provides methods for bulk updates and value retrievals.
StringIO makes a string look like an IO object. The object has read/write methods.
strscan allows for “lexical string scanning”. Lexical analysis is defined by Wikipedia as “the process of converting a sequence of characters into a sequence of tokens (strings with an assigned and thus identified meaning)”.
WEBrick is a toolkit or HTTP and HTTPS servers, and can also be configured as a proxy server or virtual-host server.
zlib provides support for the zlib compression and decompression library. zlib, the first version of which was first released in 1995, uses an abstraction of the DEFLATE lossless compression algorithm.