Class: Deptree::Visitor

Inherits:
Object
  • Object
show all
Defined in:
lib/deptree/visitor.rb,
lib/deptree/visitor/kahn.rb

Defined Under Namespace

Classes: Kahn

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(roots) ⇒ Visitor

Returns a new instance of Visitor.



9
10
11
# File 'lib/deptree/visitor.rb', line 9

def initialize(roots)
  @roots = roots
end

Class Method Details

.each(roots, &block) ⇒ Object



5
6
7
# File 'lib/deptree/visitor.rb', line 5

def self.each(roots, &block)
  new(roots).visit(&block)
end

Instance Method Details

#visit(&block) ⇒ Object



13
14
15
# File 'lib/deptree/visitor.rb', line 13

def visit(&block)
  sorted.each(&block)
end