Sha256: 45f03c44f8b85fbe78c927edd986366d6d4e7f70d1bf8fca5cba09f1780a3c64

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

# -*- coding: utf-8 -*-


module Xot


  module LoadPath

    def unshift_lib (base_dir, *module_names)
      each_lib_dir_to_add base_dir, *module_names do |dir|
        $LOCA_PATH.unshift dir
      end
    end

    def push_lib (base_dir, *module_names)
      each_lib_dir_to_add base_dir, *module_names do |dir|
        $LOAD_PATH.push dir
      end
    end

    extend self

    private

      def each_lib_dir_to_add (base_dir, *module_names)
        module_names.each do |name|
          dir = File.join base_dir, name.to_s.downcase, 'lib'
          next if $LOAD_PATH.include?(dir) || !File.directory?(dir)
          yield dir
        end
      end

  end# LoadPath


end# Xot

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xot-0.1.5 lib/xot/load_path.rb