Skip to content

Commit

Permalink
* CRITICAL BUG IN RESULTS ARRAY fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad committed Sep 18, 2009
1 parent 8601b56 commit acc4864
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/results_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def initialize(clz=nil, params=[], items=[], next_token=nil)
#puts 'class=' + clz.inspect
@params = params
@items = items
@currentset_items = items
@next_token = next_token
@i = 0
end
Expand Down Expand Up @@ -67,7 +68,7 @@ def each(&blk)
params[1] = options
end

@items.each do |v|
@currentset_items.each do |v|
#puts @i.to_s
yield v
@i += 1
Expand All @@ -81,10 +82,12 @@ def each(&blk)
unless next_token.nil?
#puts 'finding more items...'
#puts 'params in block=' + params.inspect
#puts "i from results_array = " + @i.to_s

options[:next_token] = next_token
res = clz.find(*params)
items = res.items # get the real items array from the ResultsArray
items.each do |item|
@currentset_items = res.items # get the real items array from the ResultsArray
@currentset_items.each do |item|
@items << item
end
@next_token = res.next_token
Expand All @@ -102,4 +105,3 @@ def delete_at(index)

end
end

0 comments on commit acc4864

Please sign in to comment.