Skip to content

Commit

Permalink
Added @Index that tracks where the resultset is at in it's iteration.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Reeder committed Dec 1, 2010
1 parent 2208821 commit b617d5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/simple_record/results_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module SimpleRecord
class ResultsArray
include Enumerable

attr_reader :next_token, :clz, :params, :items, :i, :box_usage, :request_id
attr_reader :next_token, :clz, :params, :items, :index, :box_usage, :request_id


def initialize(clz=nil, params=[], results=nil, next_token=nil)
Expand All @@ -27,6 +27,7 @@ def initialize(clz=nil, params=[], results=nil, next_token=nil)
load_to(@options[:per_page] * @options[:page])
@start_at = @options[:per_page] * (@options[:page] - 1)
end
@index = 0
# puts 'RESULTS_ARRAY=' + self.inspect
end

Expand Down Expand Up @@ -128,6 +129,7 @@ def each2(i, &blk)
# puts "i=" + i.to_s
yield v
i += 1
@index += 1
if !limit.nil? && i >= limit
return
end
Expand Down

0 comments on commit b617d5f

Please sign in to comment.