Class: AASMMermaid::Diagram

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

Overview

Mermaid diagram

Instance Method Summary collapse

Constructor Details

#initialize(aasm:) ⇒ Diagram

Returns a new instance of Diagram.

Parameters:

  • aasm (AASM::Base)

    aasm instance



8
9
10
# File 'lib/aasm_mermaid/diagram.rb', line 8

def initialize(aasm:)
  self.aasm = aasm
end

Instance Method Details

#generateString

Returns Mermaid diagram string.

Returns:

  • (String)

    Mermaid diagram string



13
14
15
# File 'lib/aasm_mermaid/diagram.rb', line 13

def generate
  "stateDiagram-v2\n#{transitions_string}"
end