lib/eco/api/session/batch/jobs.rb in eco-helpers-3.0.19 vs lib/eco/api/session/batch/jobs.rb in eco-helpers-3.0.20
- old
+ new
@@ -79,11 +79,11 @@
@jobs[job.name] = job
@callbacks[job] = block if block_given?
end
def pending?
- any? {|job| job.pending?}
+ any?(&:pending?)
end
# Launches every `Batch::Job` in the group.
# @note
# - if there was post-launch callback for a `Batch::Job`, it calls it.
@@ -106,22 +106,20 @@
each_with_object([]) do |job, jbs|
jbs.push(job) if job.type == type
end
end
- def status
+ def status(&block)
if block_given?
- status.each do |job, job_status|
- yield(job, job_status)
- end
+ status.each(&block)
self
- else # rubocop:disable Naming/MemoizedInstanceVariableName
- @jobs_status ||= {}
+ else
+ @jobs_status ||= {} # rubocop:disable Naming/MemoizedInstanceVariableName
end
end
def errors?
- any? {|job| job.errors?}
+ any?(&:errors?)
end
def summary
[].tap do |msg|
map {|job| msg << job.summary}