Class: MavenPom::Sorter

Inherits:
Object
  • Object
show all
Defined in:
lib/maven_pom/sorter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(poms) ⇒ Sorter

Returns a new instance of Sorter.



9
10
11
12
# File 'lib/maven_pom/sorter.rb', line 9

def initialize(poms)
  @poms = poms
  build_graph
end

Instance Attribute Details

#dagObject (readonly)

Returns the value of attribute dag.



7
8
9
# File 'lib/maven_pom/sorter.rb', line 7

def dag
  @dag
end

Instance Method Details

#sortObject



14
15
16
17
# File 'lib/maven_pom/sorter.rb', line 14

def sort
  sorted_keys = @dag.topsort_iterator.to_a.reverse
  sorted_keys.map { |key| @map[key] }.compact
end