Rich Units

RichUnits is a very easy to use unit system for the Ruby programming language. It is essentially the same system popularized by Ruby on Rails.


Rich Units is a straight-forward units system based-on the original time units work by Rich Kilmer (circa 2002-2004). Rich Units extends core Ruby with conveneice methods for dealing with measures. The methods work by converting those measures to a low common denominator; for instance all durations are stored in seconds.

Rich Units provides essentially the same unit system used by Ruby on Rails*. But Rich Units seeks to imporve upon this code, and provides a superset of functionality, partly derived from the Ruby Facets distribution of the same libraries. Ultimately Rich Units intent is to provide a better system than either of these large projects can provide, by virture of a dedicated development track.

*with the present exception of the timezone extensions (coming soon).


Primarily Rich Units extends Numeric. Here are some basic examples:

      require 'rich_units'

      4.days.hence    #=> Tue Apr 01 08:04:17 -0400 2008
      4.hours.ago     #=> Thu Mar 27 22:03:33 -0400 2008

      10.bytes        #=> 80

Rich Units also extends Time.

      require 'rich_units'                   #=> Fri Mar 28 08:10:40 -0400 2008    #=> Wed Mar 28 08:10:47 -0400 2012


Installing the RubyGem is of course straight forward.

      $ sudo gem install rich_units

Manual site_ruby installation is provided via Ruby Setup.

      $ tar -xvzf rich_units-0.4.0.tgz
      $ cd rich_units-0.4.0
      $ sudo setup.rb all


You can use gitweb to browse the 'richunits' repository.

Anonymous Repository Access

To pull the 'richunits' repository anonymously, use:

      git clone git://

Master Developer Repository Access

Developers: You can push to the 'richunits' repository using:

Only project developers have access to this repository. Please contact transfire at if you'd like to join the development team.

Contributor Repository Access

This project is also hosted on GitHub at