lib/percheron/graph.rb in percheron-0.7.16 vs lib/percheron/graph.rb in percheron-0.8.0
- old
+ new
@@ -85,29 +85,28 @@
shape = unit.startable? ? 'box' : 'ellipse'
label = [ '<font face="Arial Bold" point-size="12">%s</font><br/>' % unit.name ]
unit.ports.each do |ports|
label << '<font point-size="11">p: %s, i: %s</font>' % ports.split(':')
end
- { shape: shape, label: '<%s>' % label.join('<br/>'), fontname: 'arial' }
+ { shape: shape, label: '<%s>' % [ label.join('<br/>') ], fontname: 'arial' }
end
def pseudo_node_opts(unit)
node_opts(unit).merge!(style: 'filled', color: 'white')
end
def add_links
units.each do |name, unit|
- unit.dependant_units.each do |dependant_name, dependant_unit|
- graph.add_edges(nodes[name], nodes[dependant_name], node_link_opts(dependant_unit))
+ unit.needed_units.each do |needed_name, needed_unit|
+ graph.add_edges(nodes[name], nodes[needed_name], node_link_opts(needed_unit))
end
end
end
def node_link_opts(unit)
direction = unit.startable? ? 'forward' : 'none'
style = unit.startable? ? 'solid' : 'solid'
color = unit.startable? ? 'black' : 'gray'
{ dir: direction, style: style, color: color }
end
-
end
end