Create a new node
In:
xNodeName : ID of the node
oGParrent : Graph
# File lib/graphviz/node.rb, line 34 def initialize( xNodeName, oGParrent ) @xNodeName = xNodeName @oGParrent = oGParrent @oAttrNode = GraphViz::Attrs::new( nil, "node", NODESATTRS ) @index = nil end
Create an edge between the current node and the node oNode
# File lib/graphviz/node.rb, line 114 def <<( oNode ) if( oNode.class == Array ) oNode.each do |no| self << no end else return GraphViz::commonGraph( oNode, self ).add_edge( self, oNode ) end end
Get the value of the node attribut xAttrName
# File lib/graphviz/node.rb, line 85 def []( xAttrName ) if Hash === xAttrName xAttrName.each do |key, value| self[key] = value end else (@oAttrNode[xAttrName.to_s].nil?)?nil:@oAttrNode[xAttrName.to_s].clone end end
Set value xAttrValue to the node attribut xAttrName
# File lib/graphviz/node.rb, line 77 def []=( xAttrName, xAttrValue ) xAttrValue = xAttrValue.to_s if xAttrValue.class == Symbol @oAttrNode[xAttrName.to_s] = xAttrValue end
Calls block once for each attribut of the node, passing the name and value to the block as a two-element array.
If global is set to false, the block does not receive the attributs set globally
# File lib/graphviz/node.rb, line 101 def each_attribut(global = true, &b) attrs = @oAttrNode.to_h if global attrs = pg.node.to_h.merge attrs end attrs.each do |k,v| yield(k,v) end end
Get the node ID
# File lib/graphviz/node.rb, line 53 def id @xNodeName.clone end
Return the node index
# File lib/graphviz/node.rb, line 60 def index @index end
Get the node ID
# File lib/graphviz/node.rb, line 44 def name # TODO : Remove in v1.0 warn "GraphViz::Node#name is deprecated, please use GraphViz::Node#id! -- BE CAREFUL, it will be removed in the 1.0 version!" return self.id end
Generated with the Darkfish Rdoc Generator 2.