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.
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
#attributes ⇒ Hash
Returns Any attributes specified for this edge.
45 46 47 |
# File 'lib/graphviz/edge.rb', line 45 def attributes @attributes end |
#destination ⇒ Node (readonly)
Returns The destination node.
42 43 44 |
# File 'lib/graphviz/edge.rb', line 42 def destination @destination end |
#source ⇒ Node (readonly)
Returns The source node.
39 40 41 |
# File 'lib/graphviz/edge.rb', line 39 def source @source end |
Instance Method Details
#to_s ⇒ String
Returns A convenient ASCII arrow.
48 49 50 |
# File 'lib/graphviz/edge.rb', line 48 def to_s "#{@source} -> #{@destination}" end |