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

- old
+ new

@@ -24,21 +24,20 @@ end def new(name, order: :last) fatal "Can't create job group named '#{name}' because it already exists." if exists?(name) - group = BatchJobs.new(enviro, name: name) - @groups[name] = group + BatchJobs.new(enviro, name: name).tap do |group| + @groups[name] = group - if order == :last - @order.push(group) - else - @order.unshift(group) - end + if order == :last + @order.push(group) + else + @order.unshift(group) + end - @callbacks[group] = Proc.new if block_given? - - group + @callbacks[group] = Proc.new if block_given? + end end def pending? @groups.any? do |group| group.pending?