Class: Hashira::Diagram::Dot
- Inherits:
-
Object
- Object
- Hashira::Diagram::Dot
- Defined in:
- lib/hashira/diagram/dot.rb
Instance Method Summary collapse
-
#initialize(edges) ⇒ Dot
constructor
A new instance of Dot.
- #source ⇒ Object
Constructor Details
#initialize(edges) ⇒ Dot
Returns a new instance of Dot.
6 7 8 |
# File 'lib/hashira/diagram/dot.rb', line 6 def initialize(edges) @edges = edges end |
Instance Method Details
#source ⇒ Object
10 11 12 13 |
# File 'lib/hashira/diagram/dot.rb', line 10 def source lines = @edges.map { |from, to, weight| %( "#{from}" -> "#{to}" [label="#{weight}"];) } "digraph hashira {\n rankdir=LR;\n#{lines.join("\n")}\n}" end |