Ruby Treasures is a pet project of mine that I think contains a lot of nifty
add-ons for Ruby. Some of these may be more useful than others; that's for
you to decide.
The latest version is 0.5. It has a few
bugfixes, support for Ruby 1.8, and some new features (Object#become,
LazyEvaluator, RubyVersion, and performing_action). You may:
Old versions are also available:
Note that the data structures that were in version 0.1 are now part of
The project has just a few goals:
- To implement common utility classes that are missing from the Ruby
- Miscellaneous useful classes for writing Ruby applications.
- Interesting hacks and tweaks to the interpreter and/or library that
may or may not be of use to people.
The primary goal, however, is for me to have fun writing the library and to
learn something about Ruby in the process.
Some interesting treasures contained in the library:
[an error occurred while processing this directive]
- Miscellaneous thread synchronization helpers
- A Reactor mechanism for multiplexing I/O in a single thread
- Inline C function support
- A call stack for accessing the caller's binding and other information
- Safe message passing (replacements for Object#send() and Object#method)
that does not call private and protected methods
- Private instance variables and private class variables that are only
available in the class that created them
- New methods requirelocal and loadlocal for requiring/loading a file
from the same directory as the calling file.
- Constant methods that are not allowed to change the object they
- Finalizers that get called before an object gets destroyed.
- Helper classes for working with exceptions
- New types of object references (const ref, mutable ref)