Parent

Included Modules

GraphViz::Edge

Public Class Methods

new( vNodeOne, vNodeTwo, oGParrent ) click to toggle source

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

Public Instance Methods

[]( xAttrName ) click to toggle source

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
[]=( xAttrName, xAttrValue ) click to toggle source

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
each_attribut(global = true, &b) click to toggle source

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
head_node( with_port = true ) click to toggle source
Alias for: node_two
index() click to toggle source

Return the index of the edge

# File lib/graphviz/edge.rb, line 81
      def index
        @index
end
node_one( with_port = true ) click to toggle source

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
Also aliased as: tail_node
node_two( with_port = true ) click to toggle source

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
Also aliased as: head_node
root_graph() click to toggle source

Return the root graph

# File lib/graphviz/edge.rb, line 143
def root_graph
  return( (self.pg.nil?) ? nil : self.pg.root_graph )
end
set( &b ) click to toggle source

Set edge attributs

Example :

e = graph.add_edge( ... )
...
e.set { |_e|
  _e.color = "blue"
  _e.fontcolor = "red"
}
# File lib/graphviz/edge.rb, line 162
def set( &b )
  yield( self )
end
tail_node( with_port = true ) click to toggle source
Alias for: node_one

[Validate]

Generated with the Darkfish Rdoc Generator 2.