rbx-require-relative

Ruby 1.9's require_relative for Rubinius and MRI 1.8. We also add abs_path which is like __FILE__ but __FILE__ can be fooled by a sneaky "chdir" while abs_path can't. If you are running on Ruby 1.9 or greater, require_relative is the pre-defined version. The benefit we provide in this situation by this package is the ability to write the same require_relative sequence in Rubinius 1.8 and Ruby 1.9.


License
BSD-2-Clause
Install
gem install rbx-require-relative -v 0.0.9

Documentation

Ruby 1.9’s relative_relative for Rubinus and MRI 1.8

Here we add in Module RequireRelative method: require_relative, and abs_file. Example:

require 'rubygems'; require 'require_relative'
require_relative './lib/foo' 
absolute_path = RequireRelative.abs_file

But why abs_file? Well, recall that __FILE__ does not give an absolute path. So if you have chdir’d before using __FILE__, you might not be able to retrieve the full path.

The latest version is at http://github.com/rocky/rbx-require-relative/