Class: Gush::Graph
- Inherits:
-
Object
- Object
- Gush::Graph
- Defined in:
- lib/gush/graph.rb
Instance Attribute Summary collapse
-
#end_node ⇒ Object
readonly
Returns the value of attribute end_node.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#workflow ⇒ Object
readonly
Returns the value of attribute workflow.
Instance Method Summary collapse
-
#initialize(workflow, options = {}) ⇒ Graph
constructor
A new instance of Graph.
- #viz ⇒ Object
Constructor Details
#initialize(workflow, options = {}) ⇒ Graph
Returns a new instance of Graph.
5 6 7 8 9 |
# File 'lib/gush/graph.rb', line 5 def initialize(workflow, = {}) @workflow = workflow @filename = .fetch(:filename, "graph.png") @path = .fetch(:path, Pathname.new(Dir.tmpdir).join(filename)) end |
Instance Attribute Details
#end_node ⇒ Object (readonly)
Returns the value of attribute end_node.
3 4 5 |
# File 'lib/gush/graph.rb', line 3 def end_node @end_node end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
3 4 5 |
# File 'lib/gush/graph.rb', line 3 def filename @filename end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/gush/graph.rb', line 3 def path @path end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
3 4 5 |
# File 'lib/gush/graph.rb', line 3 def start @start end |
#workflow ⇒ Object (readonly)
Returns the value of attribute workflow.
3 4 5 |
# File 'lib/gush/graph.rb', line 3 def workflow @workflow end |
Instance Method Details
#viz ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gush/graph.rb', line 11 def viz GraphViz.new(:G, ) do |graph| (graph) (graph) @start = graph.start(shape: 'diamond', fillcolor: '#CFF09E') @end_node = graph.end(shape: 'diamond', fillcolor: '#F56991') workflow.jobs.each do |job| add_job(graph, job) end graph.output(png: path) end end |