lib/google/cloud/bigquery/job/list.rb in google-cloud-bigquery-1.28.0 vs lib/google/cloud/bigquery/job/list.rb in google-cloud-bigquery-1.29.0
- old
+ new
@@ -70,12 +70,12 @@
# end
def next
return nil unless next?
ensure_service!
next_kwargs = @kwargs.merge token: token
- next_gapi = @service.list_jobs next_kwargs
- self.class.from_gapi next_gapi, @service, next_kwargs
+ next_gapi = @service.list_jobs(**next_kwargs)
+ self.class.from_gapi next_gapi, @service, **next_kwargs
end
##
# Retrieves remaining results by repeatedly invoking {#next} until
# {#next?} returns `false`. Calls the given block once for each
@@ -119,15 +119,15 @@
#
# bigquery.jobs.all(request_limit: 10) do |job|
# puts job.state
# end
#
- def all request_limit: nil
+ def all request_limit: nil, &block
request_limit = request_limit.to_i if request_limit
return enum_for :all, request_limit: request_limit unless block_given?
results = self
loop do
- results.each { |r| yield r }
+ results.each(&block)
if request_limit
request_limit -= 1
break if request_limit.negative?
end
break unless results.next?