lib/frizz/remote.rb in frizz-2.0.0 vs lib/frizz/remote.rb in frizz-2.1.0

- old
+ new

@@ -41,19 +41,24 @@ def ignore?(object) ignorance.ignore?(object.key) end def objects - client.list_objects(bucket: bucket_name).contents + paginate(client.list_objects(bucket: bucket_name), []) end def client @client ||= Aws::S3::Client.new( region: options[:region], credentials: Aws::Credentials.new( Frizz.configuration.access_key_id, Frizz.configuration.secret_access_key ) ) + end + + def paginate(response, contents = []) + contents.push *response.contents + response.next_page? ? paginate(response.next_page, contents) : contents end end end