mock_redis 0.47.0 → 0.48.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/mock_redis/list_methods.rb +26 -0
- data/lib/mock_redis/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26618cb2f979e3a5b41cddceeb4eb971464d888fc38fc6955ffbd4c82a57ee8a
|
4
|
+
data.tar.gz: a594c4ec60eedd2668627ce28c693d299d76fb04cd23e0c03e0320780ef4371c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3cdbc6a34c8169b0339e7b3fca3a8ff0e21559b86ddb1d2940bb9acdce8b5836c1f3be0c8012a679b8c595e1964908f706db27989be58002c020a0ad8b04d0f
|
7
|
+
data.tar.gz: a0ceba58641000d933ea25dd1f82b826b6be54561febbbb5d30fcb065c0aa72ae585a1012e44fac4a0d0503b0f1fc0479ad3eeaefe857c71cdad4cd67c124a69
|
data/CHANGELOG.md
CHANGED
@@ -90,6 +90,32 @@ class MockRedis
|
|
90
90
|
with_list_at(key, &:length)
|
91
91
|
end
|
92
92
|
|
93
|
+
def lmpop(*keys, **options)
|
94
|
+
keys.each do |key|
|
95
|
+
assert_listy(key)
|
96
|
+
end
|
97
|
+
|
98
|
+
modifier = options.is_a?(Hash) && options[:modifier]&.to_s&.downcase || 'left'
|
99
|
+
count = (options.is_a?(Hash) && options[:count]) || 1
|
100
|
+
|
101
|
+
unless %w[left right].include?(modifier)
|
102
|
+
raise Redis::CommandError, 'ERR syntax error'
|
103
|
+
end
|
104
|
+
|
105
|
+
keys.each do |key|
|
106
|
+
record_count = llen(key)
|
107
|
+
next if record_count.zero?
|
108
|
+
|
109
|
+
values = [count, record_count].min.times.map do
|
110
|
+
modifier == 'left' ? with_list_at(key, &:shift) : with_list_at(key, &:pop)
|
111
|
+
end
|
112
|
+
|
113
|
+
return [key, values]
|
114
|
+
end
|
115
|
+
|
116
|
+
nil
|
117
|
+
end
|
118
|
+
|
93
119
|
def lmove(source, destination, wherefrom, whereto)
|
94
120
|
assert_listy(source)
|
95
121
|
assert_listy(destination)
|
data/lib/mock_redis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mock_redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.48.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
@@ -125,10 +125,10 @@ licenses:
|
|
125
125
|
- MIT
|
126
126
|
metadata:
|
127
127
|
bug_tracker_uri: https://github.com/sds/mock_redis/issues
|
128
|
-
changelog_uri: https://github.com/sds/mock_redis/blob/v0.
|
129
|
-
documentation_uri: https://www.rubydoc.info/gems/mock_redis/0.
|
128
|
+
changelog_uri: https://github.com/sds/mock_redis/blob/v0.48.0/CHANGELOG.md
|
129
|
+
documentation_uri: https://www.rubydoc.info/gems/mock_redis/0.48.0
|
130
130
|
homepage_uri: https://github.com/sds/mock_redis
|
131
|
-
source_code_uri: https://github.com/sds/mock_redis/tree/v0.
|
131
|
+
source_code_uri: https://github.com/sds/mock_redis/tree/v0.48.0
|
132
132
|
post_install_message:
|
133
133
|
rdoc_options: []
|
134
134
|
require_paths:
|