Sha256: 177bba06bc8387ea69139ed046ae184382626d4c4ad45ddffd751539717fd7c6

Contents?: true

Size: 414 Bytes

Versions: 5

Compression:

Stored size: 414 Bytes

Contents

module Alki
  module Reload
    class LoadPathHandler
      def initialize(root_dir,dirs)
        @dirs = dirs.map{|d| File.join(root_dir,d,'')}.select{|d| Dir.exist? d }
      end

      attr_reader :dirs

      def handle_path(path)
        @dirs.each do |dir|
          if path.start_with? dir
            return path[dir.size..-1].chomp('.rb')
          end
        end
        nil
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alki-reload-0.3.4 lib/alki/reload/load_path_handler.rb
alki-reload-0.3.3 lib/alki/reload/load_path_handler.rb
alki-reload-0.3.2 lib/alki/reload/load_path_handler.rb
alki-reload-0.3.1 lib/alki/reload/load_path_handler.rb
alki-reload-0.2.0 lib/alki/reload/load_path_handler.rb