Class: Frill::DependencyGraph::CycleDetecter

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nodes) ⇒ CycleDetecter

Returns a new instance of CycleDetecter.



111
112
113
114
# File 'lib/frill/frill.rb', line 111

def initialize nodes
  @nodes = nodes
  @visited = {}
end

Class Method Details

.detect!(nodes) ⇒ Object



107
108
109
# File 'lib/frill/frill.rb', line 107

def self.detect! nodes
  new(nodes).detect!
end

Instance Method Details

#detect!Object



116
117
118
119
120
# File 'lib/frill/frill.rb', line 116

def detect!
  nodes.values.each do |node|
    fan_out node unless visited[node.label]
  end
end