Skip to content
A collection of better replacements for Ruby standard libaries
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Better is a collection of better replacements Ruby standard libraries. The versions shipped with Ruby have problems, which this library intends to fix. It is my wish that this code will one day find its way back to upstream Ruby.


Install with:

gem install better

All of the libraries in Better are drop-in replacement and have the exact same API as the original, and work on both Ruby 1.8 and 1.9. For example, instead of

require 'tempfile'

you just prefix the library filename with 'better/' and the class name with 'Better::':

require 'better/tempfile'

Or you can even override the standard version by requiring the library with the 'better/override/' prefix:

require 'better/override/tempfile'
Tempfile  # => now refers to Better::Tempfile instead of ::Tempfile

This last feature should of course be used with care.

Please refer to the individual classes for more documentation.


The Github repository is located at Is there a Ruby standard library that you think can be improved? Just fork the repository and start hacking! It doesn't matter whether you want to fix a small bug, want to write unit tests or just want to improve documentation - anything is fine.

You can contact me at:

  • Hongli Lai (

Something went wrong with that request. Please try again.