Class: Alki::Reload::LoadPathHandler
- Inherits:
-
Object
- Object
- Alki::Reload::LoadPathHandler
- Defined in:
- lib/alki/reload/load_path_handler.rb
Instance Attribute Summary collapse
-
#dirs ⇒ Object
readonly
Returns the value of attribute dirs.
Instance Method Summary collapse
- #handle_path(path) ⇒ Object
-
#initialize(root_dir, dirs) ⇒ LoadPathHandler
constructor
A new instance of LoadPathHandler.
Constructor Details
#initialize(root_dir, dirs) ⇒ LoadPathHandler
Returns a new instance of LoadPathHandler.
4 5 6 |
# File 'lib/alki/reload/load_path_handler.rb', line 4 def initialize(root_dir,dirs) @dirs = dirs.map{|d| File.join(root_dir,d,'')}.select{|d| Dir.exist? d } end |
Instance Attribute Details
#dirs ⇒ Object (readonly)
Returns the value of attribute dirs.
8 9 10 |
# File 'lib/alki/reload/load_path_handler.rb', line 8 def dirs @dirs end |
Instance Method Details
#handle_path(path) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/alki/reload/load_path_handler.rb', line 10 def handle_path(path) @dirs.each do |dir| if path.start_with? dir return path[dir.size..-1].chomp('.rb') end end nil end |