Class: DependencyResolver
- Inherits:
-
Object
- Object
- DependencyResolver
- Defined in:
- lib/dependence/dependency_resolver.rb
Instance Method Summary collapse
-
#initialize(file_list, file_path) ⇒ DependencyResolver
constructor
A new instance of DependencyResolver.
- #sorted_files ⇒ Object
Constructor Details
#initialize(file_list, file_path) ⇒ DependencyResolver
Returns a new instance of DependencyResolver.
5 6 7 8 9 |
# File 'lib/dependence/dependency_resolver.rb', line 5 def initialize(file_list, file_path) @files = file_list @file_path = file_path @graph = RGL::DirectedAdjacencyGraph.new end |
Instance Method Details
#sorted_files ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/dependence/dependency_resolver.rb', line 11 def sorted_files @files.each do |file| @graph.add_vertex(file) dependencies = get_dependencies_in(file) dependencies.each {|dependency| @graph.add_edge(dependency,file) } end @graph.topsort_iterator.to_a end |