mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
parent
8a048c6c3f
commit
696b2ddb1e
2 changed files with 34 additions and 0 deletions
|
@ -39,6 +39,23 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
alias :each_file_this_page :each
|
||||
def each
|
||||
if !block_given?
|
||||
self
|
||||
else
|
||||
subset = dup.all
|
||||
|
||||
subset.each_file_this_page {|f| yield f}
|
||||
while subset.is_truncated
|
||||
subset = subset.all(:marker => subset.last.key)
|
||||
subset.each_file_this_page {|f| yield f}
|
||||
end
|
||||
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
def get(key, options = {}, &block)
|
||||
requires :directory
|
||||
data = connection.get_object(directory.key, key, options, &block)
|
||||
|
|
|
@ -35,6 +35,23 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
alias :each_file_this_page :each
|
||||
def each
|
||||
if !block_given?
|
||||
self
|
||||
else
|
||||
subset = dup.all
|
||||
|
||||
subset.each_file_this_page {|f| yield f}
|
||||
until subset.empty? || subset.length == (subset.limit || 10000)
|
||||
subset = subset.all(:marker => subset.last.key)
|
||||
subset.each_file_this_page {|f| yield f}
|
||||
end
|
||||
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
def get(key, &block)
|
||||
requires :directory
|
||||
data = connection.get_object(directory.key, key, &block)
|
||||
|
|
Loading…
Reference in a new issue