Class: ImportGraph::PathManager
- Inherits:
-
Object
- Object
- ImportGraph::PathManager
- Defined in:
- lib/import_graph/path_manager.rb
Instance Method Summary collapse
-
#initialize(dir_path) ⇒ PathManager
constructor
A new instance of PathManager.
- #resolve_paths(matches) ⇒ Object
Constructor Details
#initialize(dir_path) ⇒ PathManager
Returns a new instance of PathManager.
5 6 7 |
# File 'lib/import_graph/path_manager.rb', line 5 def initialize(dir_path) @dir_path = dir_path end |
Instance Method Details
#resolve_paths(matches) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/import_graph/path_manager.rb', line 9 def resolve_paths(matches) # run a map on matches and modify the paths matches.map do |match| local = match local[:to] += '.rb' unless local[:to].end_with? '.rb' case local[:method] when :require, :load, :autoload if local[:to].start_with?('./') || local[:to].start_with?('../') local[:to] = File.(File.join(Dir.pwd, local[:to])) end end local end end |