Sha256: 2656c3b4d2fc5ff0030e0ddfbdcd304b7881e51b68e6d2acc2f196115d8b5438

Contents?: true

Size: 452 Bytes

Versions: 1

Compression:

Stored size: 452 Bytes

Contents

module LoadPath 
  class << self
    attr_accessor :base_path
  end             
  
  def self.relative_to(file, path)
    @base_path = File.join(File.dirname(file), path)    
  end
  
  def self.add(*names)
    names.each do |dir|      
      path = get_path(dir)
      $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)      
    end
  end

protected
  def self.get_path(dir)
    path = File.expand_path(File.join(base_path, dir))  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
load-me-0.1.0 lib/load-me.rb