Class: CycleDetector::DOTPrintStrategy
- Inherits:
-
Object
- Object
- CycleDetector::DOTPrintStrategy
- Defined in:
- lib/kwala/lib/cycle_detector.rb
Instance Method Summary collapse
-
#initialize ⇒ DOTPrintStrategy
constructor
A new instance of DOTPrintStrategy.
- #print_cycles(cycles) ⇒ Object
- #print_graph(graph) ⇒ Object
Constructor Details
#initialize ⇒ DOTPrintStrategy
Returns a new instance of DOTPrintStrategy.
278 279 280 |
# File 'lib/kwala/lib/cycle_detector.rb', line 278 def initialize @visited = Hash.new(false) end |
Instance Method Details
#print_cycles(cycles) ⇒ Object
292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/kwala/lib/cycle_detector.rb', line 292 def print_cycles(cycles) print_dot_wrapper do if cycles.size > 0 cycles.each do |path| print_cycle_path(path) end end end end |
#print_graph(graph) ⇒ Object
282 283 284 285 286 287 288 289 290 |
# File 'lib/kwala/lib/cycle_detector.rb', line 282 def print_graph(graph) print_dot_wrapper do print_sub_clusers(graph.keys) graph.sort.each do |k, v| print_node(v) end end end |