cassie 1.0.0.beta.3 → 1.0.0.beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df9c9472bd40950a8fb5cae45a95ab79661276f6
4
- data.tar.gz: 79a9cad9af8d1410c73937f4c8ff52da630f40b5
3
+ metadata.gz: 2b68910ecc81a9d339e0a59ee8b46adc36841089
4
+ data.tar.gz: 42a0a317184f67ad97c9d7281378fedf787eb605
5
5
  SHA512:
6
- metadata.gz: 1a331744722854ba71c48f432b41a1e19c54ee3ba15f40cd44922ba0be832d591ed31895faf8c371cb22b952bbf2e6aec1303c86b390bb08e2ae01bdf56887e6
7
- data.tar.gz: 59939300bfc14cb906015dee1fa13dafa72050011853f33a82cb1a11bd6bb42b293905529750bd9dd56e4e4bc0bed2e39806b3439b7b6ecb68a94a0e7a9251fe
6
+ metadata.gz: 096994330cb1cd057c68d1fc90276d682426f91b9be08939f372d9e8c980c2f0857b1fdd5db7750826fbae94caab1073576a849fff2eb8a33163cb8c697a1cd4
7
+ data.tar.gz: 28a4de6c7522a2c360af1472cc6e76d52a0b1957fe7c94a1e1460072b7b2fabcbcecaaa32b91884e91622f5c733d65c79d14ae3cf6924cb036621ff41e251c8e
@@ -236,37 +236,37 @@ Similar to [Rails Batching](http://guides.rubyonrails.org/v4.2/active_record_que
236
236
  ###### `fetch_each`
237
237
  ```
238
238
  UsersQuery.new.fetch_each do |user|
239
- # hey look, only 1000 loaded at a time!
239
+ # only 1000 queried and loaded at a time
240
240
  end
241
241
  ```
242
242
 
243
243
  ```
244
244
  UsersQuery.new.fetch_each(batch_size: 500) do |user|
245
- # hey look, only 500 loaded at a time!
245
+ # only 500 queried and loaded at a time
246
246
  end
247
247
  ```
248
248
 
249
249
  ```
250
250
  UsersQuery.new.fetch_each.with_index do |user, index|
251
- # hey look, Enumerator chaining!
251
+ # Enumerator chaining without a block
252
252
  end
253
253
  ```
254
254
  ###### `fetch_in_batches`
255
255
  ```
256
256
  UsersQuery.new.fetch_in_batches do |users_array|
257
- # hey look, only 1000 loaded at a time!
257
+ # only 1000 queried and at a time
258
258
  end
259
259
  ```
260
260
 
261
261
  ```
262
262
  UsersQuery.new.fetch_in_batches(batch_size: 500) do |users_array|
263
- # hey look, only 500 loaded at a time!
263
+ # only 500 queried and at a time
264
264
  end
265
265
  ```
266
266
 
267
267
  ```
268
268
  UsersQuery.new.fetch_in_batches.with_index do |group, index|
269
- # hey look, Enumerator chaining!
269
+ # Enumerator chaining without a block
270
270
  end
271
271
  ```
272
272
 
@@ -297,7 +297,7 @@ end
297
297
  ```
298
298
 
299
299
  ```ruby
300
- UsersByUsernameQuery.new.find(username: "eprothro")
300
+ UsersByUsernameQuery.new.fetch_first(username: "eprothro")
301
301
  => #<User:0x007fedec219cd8 @id=123, @username="eprothro">
302
302
  ```
303
303
 
@@ -11,7 +11,12 @@ module Cassie::Queries::Statement
11
11
  attr_reader :stateless_page_size
12
12
  end
13
13
 
14
- def fetch_each
14
+ def fetch_each(opts={})
15
+ return to_enum(:fetch_each, opts) unless block_given?
16
+
17
+ fetch_in_batches(opts) do |rows|
18
+ rows.each { |row| yield row }
19
+ end
15
20
  end
16
21
 
17
22
  # Yields each batch of records that was found by the options as an array.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta.3
4
+ version: 1.0.0.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Prothro