Class: Seafoam::MarkdownWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/seafoam/markdown_writer.rb

Overview

A writer from graphs to Markdown format, with an embedded Mermaid graph.

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ MarkdownWriter

Returns a new instance of MarkdownWriter.



6
7
8
# File 'lib/seafoam/markdown_writer.rb', line 6

def initialize(stream)
  @stream = stream
end

Instance Method Details

#write_graph(graph) ⇒ Object

Write a graph.



11
12
13
14
15
16
# File 'lib/seafoam/markdown_writer.rb', line 11

def write_graph(graph)
  @stream.puts "```mermaid"
  mermaid = MermaidWriter.new(@stream)
  mermaid.write_graph(graph)
  @stream.puts "```"
end