Class: Marmerdo::OutputGenerator
- Inherits:
-
Object
- Object
- Marmerdo::OutputGenerator
- Defined in:
- lib/marmerdo/output_generator.rb
Overview
This class generates a markdown or mermaid file from a mermaid diagram.
Defined Under Namespace
Classes: UnknownOutputExtensionError
Constant Summary collapse
- WARNING_COMMENT =
"This file was generated by Marmerdo. Do not edit it manually.".freeze
Instance Method Summary collapse
- #generate ⇒ String
-
#initialize(output_path, domain_diagram) ⇒ OutputGenerator
constructor
A new instance of OutputGenerator.
Constructor Details
#initialize(output_path, domain_diagram) ⇒ OutputGenerator
Returns a new instance of OutputGenerator.
14 15 16 17 |
# File 'lib/marmerdo/output_generator.rb', line 14 def initialize(output_path, domain_diagram) @output_path = output_path @domain_diagram = domain_diagram end |
Instance Method Details
#generate ⇒ String
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/marmerdo/output_generator.rb', line 20 def generate case output_filetype when :markdown [ "<!-- #{WARNING_COMMENT} -->", "", "```mermaid", @domain_diagram, "```" ].join("\n") when :mermaid [ "%% #{WARNING_COMMENT}", "", @domain_diagram ].join("\n") end end |