Module: DataMapper::ChunkedQuery::Mixin
- Defined in:
- lib/dm-chunked_query/mixin.rb
Instance Method Summary collapse
-
#batch(per_batch) {|resource| ... } ⇒ Chunks
Reads in records in batches and processes them.
-
#chunks(per_chunk) ⇒ Chunks
Allows chunked access to the resources from a query.
- #chunks_of(per_chunk) ⇒ Object
-
#each_chunk(per_chunk) {|chunk| ... } ⇒ Chunks
Enumerate over every chunk.
- #each_slice(per_chunk, &block) ⇒ Object
Instance Method Details
#batch(per_batch) {|resource| ... } ⇒ Chunks
Reads in records in batches and processes them.
78 79 80 |
# File 'lib/dm-chunked_query/mixin.rb', line 78 def batch(per_batch,&block) each_chunk(per_batch) { |chunk| chunk.each(&block) } end |
#chunks(per_chunk) ⇒ Chunks
Allows chunked access to the resources from a query.
15 16 17 |
# File 'lib/dm-chunked_query/mixin.rb', line 15 def chunks(per_chunk) Chunks.new(self,per_chunk) end |
#chunks_of(per_chunk) ⇒ Object
22 23 24 |
# File 'lib/dm-chunked_query/mixin.rb', line 22 def chunks_of(per_chunk) chunks(per_chunk) end |
#each_chunk(per_chunk) {|chunk| ... } ⇒ Chunks
Enumerate over every chunk.
45 46 47 |
# File 'lib/dm-chunked_query/mixin.rb', line 45 def each_chunk(per_chunk,&block) chunks(per_chunk).each(&block) end |
#each_slice(per_chunk, &block) ⇒ Object
54 55 56 |
# File 'lib/dm-chunked_query/mixin.rb', line 54 def each_slice(per_chunk,&block) each_chunk(per_chunk,&block) end |