Class: Graphviz::Edge
- Inherits:
-
Object
- Object
- Graphviz::Edge
- Defined in:
- lib/graphviz/edge.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.
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
#attributes ⇒ Hash
30 31 32 |
# File 'lib/graphviz/edge.rb', line 30 def attributes @attributes end |
#destination ⇒ Node (readonly)
27 28 29 |
# File 'lib/graphviz/edge.rb', line 27 def destination @destination end |
#source ⇒ Node (readonly)
24 25 26 |
# File 'lib/graphviz/edge.rb', line 24 def source @source end |
Instance Method Details
#to_s ⇒ String
33 34 35 |
# File 'lib/graphviz/edge.rb', line 33 def to_s "#{@source} -> #{@destination}" end |