Class: Hashira::Diagram::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/hashira/diagram/source.rb

Instance Method Summary collapse

Constructor Details

#initialize(graph, format, io: $stdout) ⇒ Source

Returns a new instance of Source.



4
5
6
7
8
# File 'lib/hashira/diagram/source.rb', line 4

def initialize(graph, format, io: $stdout)
  @graph = graph
  @format = format
  @io = io
end

Instance Method Details



10
11
12
13
14
# File 'lib/hashira/diagram/source.rb', line 10

def print
  edges = @graph.weighted
  @io.puts((@format == :dot ? Hashira::Diagram::Dot.new(edges) : Hashira::Diagram::Mermaid.new(edges)).source)
  0
end