lib/eco/api/session/batch/jobs.rb in eco-helpers-2.5.10 vs lib/eco/api/session/batch/jobs.rb in eco-helpers-2.6.0
- old
+ new
@@ -72,13 +72,13 @@
# @param job [Eco::API::Session::Batch::Job] the `Batch::Job` to add.
# @yield [job, status] callback after launching the batch job request against the server.
# @yieldparam job [Eco::API::Session::Batch::Job] the job we have launched against the server.
# @yieldparam status [Eco::API::Session::Batch::Status] the status of the batch job launch.
# @return [Eco::API::Session::Batch::Job]
- def add(job)
+ def add(job, &block)
fatal "Expected Eco::API::Session::Batch::Job object. Given #{job.class}" unless job.is_a?(Eco::API::Session::Batch::Job)
@jobs[job.name] = job
- @callbacks[job] = Proc.new if block_given?
+ @callbacks[job] = block if block_given?
end
def pending?
any? {|job| job.pending?}
end