Class: Alki::Reload::LoaderHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/alki/reload/loader_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_dir) ⇒ LoaderHandler



6
7
8
# File 'lib/alki/reload/loader_handler.rb', line 6

def initialize(root_dir)
  @root_dir = File.join(root_dir,'')
end

Instance Method Details

#dirsObject



21
22
23
24
25
# File 'lib/alki/reload/loader_handler.rb', line 21

def dirs
  Alki::Loader.registered_paths.select do |d|
    d.start_with?(@root_dir)
  end
end

#handle_path(path) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/alki/reload/loader_handler.rb', line 10

def handle_path(path)
  dirs.each do |dir|
    dir = File.join(dir,'')
    if path.start_with? dir
      name = Alki::Loader.lookup_name path
      return name if name
    end
  end
  nil
end