Class: RailsErd::PlantUml
- Inherits:
-
RailsERD::Diagram
- Object
- RailsERD::Diagram
- RailsErd::PlantUml
- Defined in:
- lib/rails/plant_uml.rb
Overview
PlantUML implementation of the Diagram class, which will output a .puml file that can be processed by the PlantUML renderer.
Instance Method Summary collapse
-
#initialize(domain, options = {}) ⇒ PlantUml
constructor
Initialize the diagram.
-
#save ⇒ Object
Main method to generate the PlantUML diagram.
Constructor Details
#initialize(domain, options = {}) ⇒ PlantUml
Initialize the diagram
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rails/plant_uml.rb', line 19 def initialize(domain, = {}) @domain = domain @title = [:title] || "Entity Relationship Diagram" @app_name = [:app_name] || "SOFware" @filename = [:filename] || "erd.puml" @filename += ".puml" unless @filename.end_with?(".puml") @only = [:only] = Time.current.iso8601 @markup = [] end |
Instance Method Details
#save ⇒ Object
Main method to generate the PlantUML diagram
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rails/plant_uml.rb', line 31 def save # Generate the PlantUML content generate_diagram # Write to file File.write(@filename, @markup.join("\n")) # Return the filename so it can be used in the CLI output @filename end |