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.



13
14
15
16
17
18
19
20
21
# File 'lib/graphviz/edge.rb', line 13

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

Instance Attribute Details

#attributesHash



30
31
32
# File 'lib/graphviz/edge.rb', line 30

def attributes
  @attributes
end

#destinationNode (readonly)



27
28
29
# File 'lib/graphviz/edge.rb', line 27

def destination
  @destination
end

#sourceNode (readonly)



24
25
26
# File 'lib/graphviz/edge.rb', line 24

def source
  @source
end

Instance Method Details

#to_sString



33
34
35
# File 'lib/graphviz/edge.rb', line 33

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