Class: Graphviz::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/graphviz/graph.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.



77
78
79
80
81
82
83
84
85
# File 'lib/graphviz/graph.rb', line 77

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.



94
95
96
# File 'lib/graphviz/graph.rb', line 94

def attributes
  @attributes
end

#destinationNode (readonly)

Returns The destination node.

Returns:

  • (Node)

    The destination node.



91
92
93
# File 'lib/graphviz/graph.rb', line 91

def destination
  @destination
end

#sourceNode (readonly)

Returns The source node.

Returns:

  • (Node)

    The source node.



88
89
90
# File 'lib/graphviz/graph.rb', line 88

def source
  @source
end

Instance Method Details

#to_sString

Returns A convenient ASCII arrow.

Returns:

  • (String)

    A convenient ASCII arrow.



97
98
99
# File 'lib/graphviz/graph.rb', line 97

def to_s
	'->'
end