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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bbc0edb10b18ba89981fe78e35e169dbbdc4af0886e01f07e0947f8eb7eff45
4
- data.tar.gz: 88d094d92b9c55ebc677dca8c2a6561805b79dbf11d97b2992a9c1312cccc1b1
3
+ metadata.gz: 26618cb2f979e3a5b41cddceeb4eb971464d888fc38fc6955ffbd4c82a57ee8a
4
+ data.tar.gz: a594c4ec60eedd2668627ce28c693d299d76fb04cd23e0c03e0320780ef4371c
5
5
  SHA512:
6
- metadata.gz: c805d6ad39374b422b8f0fd571ceae353e91531089c1844459dd046bbaa97b1cc8d80a6dec386f3c5f93382c39081084c799f1ad286d37e5a1d0e1c0a3f55279
7
- data.tar.gz: cfc5b689845fccd69eb744a1bc8296530ce46c3686cf15cca272bf12bad8520f12739289cc4b21e99f11762127fb74a72eda54ca19ed7e27afe90fe4d26545db
6
+ metadata.gz: a3cdbc6a34c8169b0339e7b3fca3a8ff0e21559b86ddb1d2940bb9acdce8b5836c1f3be0c8012a679b8c595e1964908f706db27989be58002c020a0ad8b04d0f
7
+ data.tar.gz: a0ceba58641000d933ea25dd1f82b826b6be54561febbbb5d30fcb065c0aa72ae585a1012e44fac4a0d0503b0f1fc0479ad3eeaefe857c71cdad4cd67c124a69
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # MockRedis Changelog
2
2
 
3
+ ### 0.48.0
4
+
5
+ * Add support for `lmpop` on Redis 7+
6
+
3
7
  ### 0.47.0
4
8
 
5
9
  * Add support for `redis-rb` gem versions 5.x
@@ -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)
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  class MockRedis
5
- VERSION = '0.47.0'
5
+ VERSION = '0.48.0'
6
6
  end
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.47.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.47.0/CHANGELOG.md
129
- documentation_uri: https://www.rubydoc.info/gems/mock_redis/0.47.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.47.0
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: