Sha256: ab39b64d1c7aa63eb3d3df065caab3ba13715f7818c26b42f8d0dc8ec144dca8
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
= Load Path Find Useful tools for looking for files on the <tt>$LOAD_PATH</tt> == 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 <tt>$LOAD_PATH</tt> and. > $LOAD_PATH.add_current! .. adds the current path to the start of the <tt>$LOAD_PATH</tt> And one more clever trick, <tt>Kernel#require_all</tt>, lets you require all matching files. Also, there is <tt>Kernel#require_next</tt> which can be used to monkey patch on require: # my_extension/stringio.rb require_next "stringio" StringIO.class_eval do # insert evil stuff here end # my_extension/setup.rb $LOAD_PATH.add_current! require "some_code_not_owned_by_me_maybe_requiring_stringio_oh_how_will_i_fool_them_all"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
load_path_find-0.0.5 | README.rdoc |