@@ -2291,12 +2291,12 @@ def scan(cursor, options={})
2291
2291
# - `:count => Integer`: return count keys at most per iteration
2292
2292
#
2293
2293
# @return [Enumerator] an enumerator for all found keys
2294
- def scan_each ( options = { } )
2294
+ def scan_each ( options = { } , & block )
2295
2295
return to_enum ( :scan_each , options ) unless block_given?
2296
2296
cursor = 0
2297
2297
loop do
2298
2298
cursor , keys = scan ( cursor , options )
2299
- keys . each { | key | yield key }
2299
+ keys . each ( & block )
2300
2300
break if cursor == "0"
2301
2301
end
2302
2302
end
@@ -2329,12 +2329,12 @@ def hscan(key, cursor, options={})
2329
2329
# - `:count => Integer`: return count keys at most per iteration
2330
2330
#
2331
2331
# @return [Enumerator] an enumerator for all found keys
2332
- def hscan_each ( key , options = { } )
2332
+ def hscan_each ( key , options = { } , & block )
2333
2333
return to_enum ( :hscan_each , key , options ) unless block_given?
2334
2334
cursor = 0
2335
2335
loop do
2336
- cursor , key_values = hscan ( key , cursor , options )
2337
- key_values . each { | key , val | yield key , val }
2336
+ cursor , values = hscan ( key , cursor , options )
2337
+ values . each ( & block )
2338
2338
break if cursor == "0"
2339
2339
end
2340
2340
end
@@ -2368,12 +2368,12 @@ def zscan(key, cursor, options={})
2368
2368
# - `:count => Integer`: return count keys at most per iteration
2369
2369
#
2370
2370
# @return [Enumerator] an enumerator for all found scores and members
2371
- def zscan_each ( key , options = { } )
2371
+ def zscan_each ( key , options = { } , & block )
2372
2372
return to_enum ( :zscan_each , key , options ) unless block_given?
2373
2373
cursor = 0
2374
2374
loop do
2375
- cursor , member_score = zscan ( key , cursor , options )
2376
- member_score . each { | member , score | yield member , score }
2375
+ cursor , values = zscan ( key , cursor , options )
2376
+ values . each ( & block )
2377
2377
break if cursor == "0"
2378
2378
end
2379
2379
end
@@ -2404,12 +2404,12 @@ def sscan(key, cursor, options={})
2404
2404
# - `:count => Integer`: return count keys at most per iteration
2405
2405
#
2406
2406
# @return [Enumerator] an enumerator for all keys in the set
2407
- def sscan_each ( key , options = { } )
2407
+ def sscan_each ( key , options = { } , & block )
2408
2408
return to_enum ( :sscan_each , key , options ) unless block_given?
2409
2409
cursor = 0
2410
2410
loop do
2411
2411
cursor , keys = sscan ( key , cursor , options )
2412
- keys . each { | key | yield key }
2412
+ keys . each ( & block )
2413
2413
break if cursor == "0"
2414
2414
end
2415
2415
end
0 commit comments