lib/google/cloud/bigquery/dataset/list.rb in google-cloud-bigquery-1.16.0 vs lib/google/cloud/bigquery/dataset/list.rb in google-cloud-bigquery-1.17.0
- old
+ new
@@ -121,31 +121,26 @@
# puts dataset.name
# end
#
def all request_limit: nil
request_limit = request_limit.to_i if request_limit
- unless block_given?
- return enum_for :all, request_limit: request_limit
- end
+ return enum_for :all, request_limit: request_limit unless block_given?
results = self
loop do
results.each { |r| yield r }
if request_limit
request_limit -= 1
- break if request_limit < 0
+ break if request_limit.negative?
end
break unless results.next?
results = results.next
end
end
##
# @private New Dataset::List from a response object.
- def self.from_gapi gapi_list, service, hidden = nil, filter = nil,
- max = nil
- datasets = List.new(Array(gapi_list.datasets).map do |gapi_object|
- Dataset.from_gapi gapi_object, service
- end)
+ def self.from_gapi gapi_list, service, hidden = nil, filter = nil, max = nil
+ datasets = List.new(Array(gapi_list.datasets).map { |gapi_object| Dataset.from_gapi gapi_object, service })
datasets.instance_variable_set :@token, gapi_list.next_page_token
datasets.instance_variable_set :@etag, gapi_list.etag
datasets.instance_variable_set :@service, service
datasets.instance_variable_set :@hidden, hidden
datasets.instance_variable_set :@filter, filter