Class: SyntaxTree::MermaidVisitor
- Inherits:
-
FieldVisitor
- Object
- BasicVisitor
- FieldVisitor
- SyntaxTree::MermaidVisitor
- Defined in:
- lib/syntax_tree/mermaid_visitor.rb
Overview
This visitor transforms the AST into a mermaid flow chart.
Instance Attribute Summary collapse
-
#flowchart ⇒ Object
readonly
Returns the value of attribute flowchart.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize ⇒ MermaidVisitor
constructor
A new instance of MermaidVisitor.
- #visit_program(node) ⇒ Object
Methods inherited from BasicVisitor
valid_visit_methods, #visit, #visit_all, #visit_child_nodes, visit_method, visit_methods
Constructor Details
#initialize ⇒ MermaidVisitor
Returns a new instance of MermaidVisitor.
8 9 10 11 |
# File 'lib/syntax_tree/mermaid_visitor.rb', line 8 def initialize @flowchart = Mermaid.flowchart @target = nil end |
Instance Attribute Details
#flowchart ⇒ Object (readonly)
Returns the value of attribute flowchart.
6 7 8 |
# File 'lib/syntax_tree/mermaid_visitor.rb', line 6 def flowchart @flowchart end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
6 7 8 |
# File 'lib/syntax_tree/mermaid_visitor.rb', line 6 def target @target end |
Instance Method Details
#visit_program(node) ⇒ Object
13 14 15 16 |
# File 'lib/syntax_tree/mermaid_visitor.rb', line 13 def visit_program(node) super flowchart.render end |