Sha256: 5dade5e15a95a65e8347835b7ccc0c1214c68be234d7d4a836308143805e9780
Contents?: true
Size: 963 Bytes
Versions: 1
Compression:
Stored size: 963 Bytes
Contents
require 'dirge' $LOAD_PATH.instance_eval do def find_file(file) find_all_files(file){|f| return f} nil end def find_all_files(file, ext = nil) file += ext if ext and File.extname(file) != ext inject([]){|ary, path| target = File.expand_path(file, path) if File.readable?(target) ary << target yield target if block_given? end ary } end def add_current self << __DIR_REL__(caller.first) end def add_current! self.unshift(__DIR_REL__(caller.first)) end end module Kernel def require_all(req) $LOAD_PATH.find_all_files(req, ".rb") { |file| require file } end def require_next(req) found, current = false, File.expand_path(caller.first[/^[^:]+/]) $LOAD_PATH.find_all_files(req, ".rb") do |file| if found $LOADED_FEATURES << req return require(file) else found = current == file end end require req end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
load_path_find-0.0.5 | lib/load_path_find.rb |