Create a new edge
In:
vNodeOne : First node (can be a GraphViz::Node or a node ID)
vNodeTwo : Second node (can be a GraphViz::Node or a node ID)
oGParrent : Graph
# File lib/graphviz/edge.rb, line 38 def initialize( vNodeOne, vNodeTwo, oGParrent ) @xNodeOne, @xNodeOnePort = getNodeNameAndPort( vNodeOne ) # if vNodeOne.class == String # @xNodeOne = vNodeOne # else # @xNodeOne = vNodeOne.id # end @xNodeTwo, @xNodeTwoPort = getNodeNameAndPort( vNodeTwo ) # if vNodeTwo.class == String # @xNodeTwo = vNodeTwo # else # @xNodeTwo = vNodeTwo.id # end @oGParrent = oGParrent @oAttrEdge = GraphViz::Attrs::new( nil, "edge", EDGESATTRS ) @index = nil end
Set values for edge attributs or get the value of the given edge attribut xAttrName
# File lib/graphviz/edge.rb, line 100 def []( xAttrName ) # Modification by axgle (http://github.com/axgle) if Hash === xAttrName xAttrName.each do |key, value| self[key] = value end else if @oAttrEdge[xAttrName.to_s] @oAttrEdge[xAttrName.to_s].clone else nil end end end
Set value xAttrValue to the edge attribut xAttrName
# File lib/graphviz/edge.rb, line 91 def []=( xAttrName, xAttrValue ) xAttrValue = xAttrValue.to_s if xAttrValue.class == Symbol @oAttrEdge[xAttrName.to_s] = xAttrValue end
Calls block once for each attribut of the edge, 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/edge.rb, line 121 def each_attribut(global = true, &b) attrs = @oAttrEdge.to_h if global attrs = pg.edge.to_h.merge attrs end attrs.each do |k,v| yield(k,v) end end
Return the index of the edge
# File lib/graphviz/edge.rb, line 81 def index @index end
Return the node one as string (so with port if any)
# File lib/graphviz/edge.rb, line 60 def node_one( with_port = true ) if @xNodeOnePort.nil? or with_port == false GraphViz.escape(@xNodeOne) else GraphViz.escape(@xNodeOne, :force => true) + ":#{@xNodeOnePort}" end end
Return the node two as string (so with port if any)
# File lib/graphviz/edge.rb, line 70 def node_two( with_port = true ) if @xNodeTwoPort.nil? or with_port == false GraphViz.escape(@xNodeTwo) else GraphViz.escape(@xNodeTwo, :force => true) + ":#{@xNodeTwoPort}" end end
Return the root graph
# File lib/graphviz/edge.rb, line 143 def root_graph return( (self.pg.nil?) ? nil : self.pg.root_graph ) end
Generated with the Darkfish Rdoc Generator 2.