Class: Graphviz::Edge
- Inherits:
-
Object
- Object
- Graphviz::Edge
- Defined in:
- lib/graphviz/graph.rb
Overview
Represents a visual edge between two nodes.
Instance Attribute Summary collapse
-
#attributes ⇒ Hash
Any attributes specified for this edge.
-
#destination ⇒ Node
readonly
The destination node.
-
#source ⇒ Node
readonly
The source node.
Instance Method Summary collapse
-
#initialize(graph, source, destination, attributes = {}) ⇒ Edge
constructor
Initialize the edge in the given graph, with a source and destination node.
-
#to_s ⇒ String
A convenient ASCII arrow.
Constructor Details
#initialize(graph, source, destination, attributes = {}) ⇒ Edge
Initialize the edge in the given graph, with a source and destination node.
110 111 112 113 114 115 116 117 118 |
# File 'lib/graphviz/graph.rb', line 110 def initialize(graph, source, destination, attributes = {}) @graph = graph @graph.edges << self @source = source @destination = destination @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Hash
Returns Any attributes specified for this edge.
127 128 129 |
# File 'lib/graphviz/graph.rb', line 127 def attributes @attributes end |
#destination ⇒ Node (readonly)
Returns The destination node.
124 125 126 |
# File 'lib/graphviz/graph.rb', line 124 def destination @destination end |
#source ⇒ Node (readonly)
Returns The source node.
121 122 123 |
# File 'lib/graphviz/graph.rb', line 121 def source @source end |
Instance Method Details
#to_s ⇒ String
Returns A convenient ASCII arrow.
130 131 132 |
# File 'lib/graphviz/graph.rb', line 130 def to_s '->' end |