Method: ModelIterator#each_set
- Defined in:
- lib/model_iterator.rb
#each_set(&block) ⇒ Object
Public: Iterates through the whole dataset. This calls #records multiple times, but does not set the #current_id after each record.
&block - Block that gets called with each ActiveRecord::Base instance.
Returns nothing.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/model_iterator.rb', line 158 def each_set(&block) loops = 0 while records = self.records begin block.call(records) loops += 1 if @max > 0 && loops >= @max raise MaxIterations, self end ensure @redis.set(key, @current_id) if @current_id end end end |