Class: Roast::WorkflowDiagramGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/roast/workflow_diagram_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(workflow_config, workflow_file_path = nil) ⇒ WorkflowDiagramGenerator

Returns a new instance of WorkflowDiagramGenerator.



5
6
7
8
9
10
11
# File 'lib/roast/workflow_diagram_generator.rb', line 5

def initialize(workflow_config, workflow_file_path = nil)
  @workflow_config = workflow_config
  @workflow_file_path = workflow_file_path
  @graph = GraphViz.new(:G, type: :digraph)
  @node_counter = 0
  @nodes = {}
end

Instance Method Details

#generate(custom_output_path = nil) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/roast/workflow_diagram_generator.rb', line 13

def generate(custom_output_path = nil)
  configure_graph
  build_graph(@workflow_config.steps)

  output_path = custom_output_path || generate_output_filename
  @graph.output(png: output_path)
  output_path
end