Class: Tinydot::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/tinydot/edge.rb

Instance Method Summary collapse

Constructor Details

#initialize(from, to, attrs = {}) ⇒ Edge

Returns a new instance of Edge.



3
4
5
6
7
# File 'lib/tinydot/edge.rb', line 3

def initialize(from, to, attrs = {})
  @from = from
  @to = to
  @attrs = attrs
end

Instance Method Details

#to_dotObject



9
10
11
12
13
# File 'lib/tinydot/edge.rb', line 9

def to_dot
  dot = "#{@from.name} -> #{@to.name}"
  dot += " [dir = both]" if @attrs[:dir] == "both"
  dot += ";"
end