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.
4 5 6 |
# File 'lib/hashira/diagram/dot.rb', line 4 def initialize(edges) @edges = edges end |
Instance Method Details
#source ⇒ Object
8 9 10 11 12 |
# File 'lib/hashira/diagram/dot.rb', line 8 def source "digraph hashira {\n rankdir=LR;\n#{@edges.map do |from, to, weight| %( "#{from}" -> "#{to}" [label="#{weight}"];) end.join("\n")}\n}" end |