Ruby Standard Library
Batteries included
Basically every programming language that you’ll use in practice has some kind of standard library that is shipped with the language itself.
When you install Ruby on your computer this will also install the Ruby Standard Library. This means
you can simply require
and use the things it includes.
Its documentation isn’t the most pretty website on earth, but if you look at the “package” (library) names on the left you see things mentioned like:
benchmark
: tools to test how performant your code isdebug
: tools to make debugging code easierdigest
,openssl
,securerandom
: tools for encryption and securityerb
: Ruby’s standard templating systemnet/imap
,net/pop
,net/smtp
: stuff for sending and receiving emailszlib
: tools for compressing files (you knowzip
files, don’t you?)
And a lot of other things. These are fairly low-level tools, of course. You do not see a library for “logging in via Twitter or Google”. They’re more like nuts and bolts, rather than bicycles or cars, but they’re super useful nonetheless.
In order to make one of these libraries available in your code you don’t have
to do anything else other than use require
. E.g. require "zlib"
would make the
zlib
library available, which means you could now use the methods deflate
and
inflate
in order to compress and decompress files.