Class: Vizier::Graph
Constant Summary
Constants included
from Support
Support::LEGAL_CHARS
Instance Attribute Summary
Attributes inherited from SubGraph
#links, #name
Instance Method Summary
collapse
Methods inherited from SubGraph
#add_link, #add_node, #build, #edge, #graph, #node, #write_comment
Methods included from Support
#attributes, #attributes=, included, #legal?, #quote, #sanitize
Methods inherited from Base
#[], #[]=
Constructor Details
#initialize(name = 'my_graph', attrs = {}) {|_self| ... } ⇒ Graph
Returns a new instance of Graph.
294
295
296
297
298
|
# File 'lib/support/vizier.rb', line 294
def initialize(name = 'my_graph', attrs = {})
@subgraphs = []
super( name, attrs )
yield self if block_given?
end
|
Instance Method Details
#cluster(name = nil, a = {}, &block) ⇒ Object
282
283
284
285
286
287
288
|
# File 'lib/support/vizier.rb', line 282
def cluster(name = nil, a = {}, &block)
if name && name = "cluster_#{name}"
subgraph( name, a, &block )
else
clusters
end
end
|
290
291
292
|
# File 'lib/support/vizier.rb', line 290
def clusters
@subgraphs.select {|s| s.name =~ /^cluster_/ }.extend( Finder )
end
|
249
250
251
|
# File 'lib/support/vizier.rb', line 249
def ( str )
( str, 1 )
end
|
#publish!(a = {}) ⇒ Object
271
272
273
|
# File 'lib/support/vizier.rb', line 271
def publish!( a = {} )
generate! end
|
#subgraph(name, a = {}) ⇒ Object
275
276
277
278
279
280
|
# File 'lib/support/vizier.rb', line 275
def subgraph(name, a = {})
returning( SubGraph.new(name, a)) do |g|
@subgraphs << g
yield g if block_given?
end
end
|
#to_str ⇒ Object
Also known as:
generate!
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
# File 'lib/support/vizier.rb', line 253
def to_str
build(["digraph #{quote name} {",
[
("global options"),
"graph #{graph};",
"node #{node};",
"edge #{edge};"
],
("nodes"),
nodes.map(&:to_str),
("links"),
links.map(&:to_str),
("subgraphs"),
subgraphs.map(&:to_str),
"}"])
end
|