lib/eco/api/session/batch_jobs.rb in eco-helpers-0.6.17 vs lib/eco/api/session/batch_jobs.rb in eco-helpers-0.7.1

- old
+ new

@@ -24,14 +24,13 @@ end def new(name, type:, sets:) fatal "Can't create job named '#{name}' because it already exists." if exists?(name) - job = BatchJob.new(enviro, name: name, type: type, sets: sets) - @jobs[name] = job - @callbacks[job] = Proc.new if block_given? - - job + BatchJob.new(enviro, name: name, type: type, sets: sets).tap do |job| + @jobs[name] = job + @callbacks[job] = Proc.new if block_given? + end end def pending? @jobs.keys.any? do |key| @jobs[key].pending?