Load Path Find

Useful tools for looking for files on the $LOAD_PATH

Usage

> require 'load_path_find'
> $LOAD_PATH.find_file('set.rb')
< "/opt/local/lib/ruby/1.8/set.rb"

.. Load a bunch of gems with spec directories ..

> $LOAD_PATH.find_all_files('../spec')

And you’ll get an array of matches.

> $LOAD_PATH.find_all_files('../spec') {|file| puts "here is a spec! #{file}"}

And now, even more awesome!

> $LOAD_PATH.add_current

.. adds the current path to your $LOAD_PATH and.

> $LOAD_PATH.add_current!

.. adds the current path to the start of the $LOAD_PATH

And one more clever trick, Kernel#require_all, lets you require all matching files.