Given the immense popularity of Rails, it's easy to overlook some of the other goldmines of the Ruby world. One of these gems is the Facets library. A collection of general-purpose methods and modules, Facets can keep you from engaging in repeated wheel-reinvention exercises in your Ruby projects. Most burgeoning Rubyists know to explore the Ruby Standard library, but I am continually surprised when talking with new Ruby developers who’ve never heard of Facets.
The Facets library is made up of two main parts. Facets/CORE is a large collection of methods that extend the objects you work with every day like String, Fixnum, Module, Hash, Kernel, and Array just to name a few. Many of these methods simplify common tasks such as checking whether or not a String begins with a certain run of letters. Rails developers will undoubtedly find some familiar extensions. Many of the methods added by ActiveSupport have been contributed back to the Facets library. Another Facets-friendly project is the Nitro/Og web and ORM framework. In fact, the list of contributors to Facets includes many of the rockstars of the Ruby world.
The other part of the Facets library is Facets/MORE, which includes whole classes and micro-frameworks to do everything from writing terminal-based applications, to converting values into SI units, to parsing XOXO files. One of my personal favorites is the Lazy module which simplifies the writing of lazily-evaluated methods in Ruby. The Facets library is quite large, but thankfully you can load as much or as little of it as you require. So the next time you find yourself about to write code to return each combination of the elements of an Array, do yourself a favor and check out Facets instead.