File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -2322,9 +2322,11 @@ def scan(cursor, options={})
2322
2322
# - `:match => String`: only return keys matching the pattern
2323
2323
# - `:count => Integer`: return count keys at most per iteration
2324
2324
#
2325
- # @return [String, Array<String>] the next cursor and all found keys
2325
+ # @return [String, Array<[ String, String] >] the next cursor and all found keys
2326
2326
def hscan ( key , cursor , options = { } )
2327
- _scan ( :hscan , cursor , options . merge ( :key => key ) )
2327
+ _scan ( :hscan , cursor , options . merge ( :key => key ) ) do |reply |
2328
+ [ reply [ 0 ] , reply [ 1 ] . each_slice ( 2 ) . to_a ]
2329
+ end
2328
2330
end
2329
2331
2330
2332
# Scan a sorted set
Original file line number Diff line number Diff line change @@ -98,15 +98,15 @@ def test_hscan_with_encoding
98
98
assert_equal enc . to_s , r . object ( "encoding" , "hash" )
99
99
100
100
cursor = 0
101
- all_keys = [ ]
101
+ all_key_values = [ ]
102
102
loop {
103
- cursor , keys = r . hscan "hash" , cursor
104
- all_keys += keys
103
+ cursor , key_values = r . hscan "hash" , cursor
104
+ all_key_values . concat key_values
105
105
break if cursor == "0"
106
106
}
107
107
108
108
keys2 = [ ]
109
- all_keys . each_slice ( 2 ) do |k , v |
109
+ all_key_values . each do |k , v |
110
110
assert_equal "key:#{ v } " , k
111
111
keys2 << k
112
112
end
You can’t perform that action at this time.
0 commit comments