lib/gush/graph.rb in gush-0.3 vs lib/gush/graph.rb in gush-0.3.1
- old
+ new
@@ -1,10 +1,10 @@
module Gush
class Graph
attr_reader :workflow, :filename, :path, :start, :end_node
- def initialize(workflow, options: {})
+ def initialize(workflow, options = {})
@workflow = workflow
@filename = options.fetch(:filename, "graph.png")
@path = options.fetch(:path, Pathname.new(Dir.tmpdir).join(filename))
end
@@ -29,20 +29,20 @@
end
private
def add_job(graph, job)
name = job.class.to_s
- graph.add_nodes(name)
+ graph.add_nodes(job.name, label: name)
if job.incoming.empty?
- graph.add_edges(start, name)
+ graph.add_edges(start, job.name)
end
if job.outgoing.empty?
- graph.add_edges(name, end_node)
+ graph.add_edges(job.name, end_node)
else
- job.outgoing.each do |out|
- graph.add_edges(name, out)
+ job.outgoing.each do |id|
+ graph.add_edges(job.name, id)
end
end
end
def set_node_options!(graph)