require_relative

In Ruby 1.9.2, "." was removed from the $LOAD_PATH. require_relative was added to let you require files relative to your current directory.

This gem backports both of these features to earlier Rubies.

Usage

require 'rubygems'
require 'require_relative'

require 'foo' #=> LoadError
require_relative 'foo' #=> works!

If you're intending to use this gem to transition from Ruby 1.8.x to 1.9.2, do this:

require 'rubygems'
require 'require_relative' if RUBY_VERSION =~ /1\.8/

And then it should run just fine on both.

Other Documentation

This gem is pretty straightforward, but we do have source documentation, generated by rocco. You can find it in the gh-pages branch of this repository or on the website.

Contributing

Please fork the project, make your commits, push them to GitHub, and make a pull request. Patches should have documentation and/or tests. Don't be afraid to make a pull request without them, if you don't know how to test something we can work on it in the comments. :)

To run the tests, simply "rake test."

To install your development version of the gem, simply "rake install".

To generate the documentation, "rake read," and it'll open in your browser.

License

require_relative is licensed under one of three licenses: WTFPL, BSD, or the same license as Ruby. Your choice.