Class: Graphviz::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/graphviz/edge.rb

Overview

Represents a visual edge between two nodes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph, source, destination, attributes = {}) ⇒ Edge

Initialize the edge in the given graph, with a source and destination node.

Parameters:

  • attributes (Hash) (defaults to: {})

    The associated graphviz attributes for this edge.


28
29
30
31
32
33
34
35
36
# File 'lib/graphviz/edge.rb', line 28

def initialize(graph, source, destination, attributes = {})
	@graph = graph
	@graph.edges << self
	
	@source = source
	@destination = destination
	
	@attributes = attributes
end

Instance Attribute Details

#attributesHash

Returns Any attributes specified for this edge.

Returns:

  • (Hash)

    Any attributes specified for this edge.


45
46
47
# File 'lib/graphviz/edge.rb', line 45

def attributes
  @attributes
end

#destinationNode (readonly)

Returns The destination node.

Returns:

  • (Node)

    The destination node.


42
43
44
# File 'lib/graphviz/edge.rb', line 42

def destination
  @destination
end

#sourceNode (readonly)

Returns The source node.

Returns:

  • (Node)

    The source node.


39
40
41
# File 'lib/graphviz/edge.rb', line 39

def source
  @source
end

Instance Method Details

#to_sString

Returns A convenient ASCII arrow.

Returns:

  • (String)

    A convenient ASCII arrow.


48
49
50
# File 'lib/graphviz/edge.rb', line 48

def to_s
	"#{@source} -> #{@destination}"
end