Sha256: e5058655969d4f9433fe40442d85d8c6d58a7ba0353526949a560c0f9f398264

Contents?: true

Size: 526 Bytes

Versions: 2

Compression:

Stored size: 526 Bytes

Contents

$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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
callsite-0.0.2 lib/loaders/load_path.rb
callsite-0.0.1 lib/loaders/load_path.rb