mock_redis 0.44.0 → 0.46.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: 7e495091d84ea1fec4bf5206d2a02e32c446ef0bd89b0feaed38f31d95b142b2
4
- data.tar.gz: 696f65058fe29cd5fa849363b6cfa60454a432c0d392f530ac1494cba31ff062
3
+ metadata.gz: ced935cd314aee4b33828b9e04c890b4bf4cf36b6e09b93cf6b3b3a3a0bd619a
4
+ data.tar.gz: def8f4648486a13f063a906df2fade9e33f703e9e5c019516f227049217c64b2
5
5
  SHA512:
6
- metadata.gz: 78b558108b350dc35df4d1f202e96326096394f9e23d89398d07cdbb33c6b088e0089467b14624a9e2c73210406457e291ab0cb09495a8d12a854df5ab8da1c3
7
- data.tar.gz: f7e6d3021a4f2f5dd78e53d126ecea26fa7d3f8903bbcf96b0cf2a03b74049acbb169a18ff571c2aab18a0678cf57b90908d06b8c0e10039e00fce5b6050ad26
6
+ metadata.gz: c73c851717ac57510e528adad4f5a6f4277abef68338d49be40871bc366937270f90d977c777e18eb0b2d0d0b1e787f3a8e3cd59a51886a57c045f655211cebe
7
+ data.tar.gz: b47fbb5cffd0d47270915cb786ac50fa30dd00fc1b064d82b1e3d754ad746b2da2a1cbdbc53e5210cd098174b7e1bac2ecbc880ee32576fe24eeea4b7e0376ed
data/CHANGELOG.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # MockRedis Changelog
2
2
 
3
+ ### 0.46.0
4
+
5
+ * Fix `hset` for array of key-value pairs
6
+
7
+ ### 0.45.0
8
+
9
+ * Add support for `count` argument of `rpop`
10
+
3
11
  ### 0.44.0
4
12
 
5
- * Add suppore for `memory usage` command
13
+ * Add support for `memory usage` command
6
14
 
7
15
  ### 0.43.0
8
16
 
data/README.md CHANGED
@@ -27,13 +27,12 @@ call the same methods on it as you can call on a real `Redis` object.
27
27
 
28
28
  For example:
29
29
 
30
- >> require 'mock_redis'
31
- >> mr = MockRedis.new
32
- >> mr.set('some key', 'some value')
33
- => "OK"
34
- >> mr.get('some key')
35
- => "some value"
36
-
30
+ ```ruby
31
+ require 'mock_redis'
32
+ mr = MockRedis.new
33
+ mr.set('some key', 'some value') # => "OK"
34
+ mr.get('some key') # => "some value"
35
+ ```
37
36
  ## Supported Features
38
37
 
39
38
  mock_redis supports most of the methods that redis-rb does. Examples
@@ -137,6 +137,7 @@ class MockRedis
137
137
 
138
138
  def hset(key, *args)
139
139
  added = 0
140
+ args.flatten!(1)
140
141
  with_hash_at(key) do |hash|
141
142
  if args.length == 1 && args[0].is_a?(Hash)
142
143
  args = args[0].to_a.flatten
@@ -186,8 +186,13 @@ class MockRedis
186
186
  end
187
187
  end
188
188
 
189
- def rpop(key)
190
- with_list_at(key) { |list| list&.pop }
189
+ def rpop(key, count = nil)
190
+ return with_list_at(key) { |list| list&.pop } if count.nil?
191
+
192
+ record_count = llen(key)
193
+ return nil if record_count.zero?
194
+
195
+ [record_count, count].min.times.map { with_list_at(key, &:pop) }
191
196
  end
192
197
 
193
198
  def rpoplpush(source, destination)
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  class MockRedis
5
- VERSION = '0.44.0'
5
+ VERSION = '0.46.0'
6
6
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mock_redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.0
4
+ version: 0.46.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  - Samuel Merritt
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-01-25 00:00:00.000000000 Z
12
+ date: 2024-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -124,11 +124,11 @@ licenses:
124
124
  - MIT
125
125
  metadata:
126
126
  bug_tracker_uri: https://github.com/sds/mock_redis/issues
127
- changelog_uri: https://github.com/sds/mock_redis/blob/v0.44.0/CHANGELOG.md
128
- documentation_uri: https://www.rubydoc.info/gems/mock_redis/0.44.0
127
+ changelog_uri: https://github.com/sds/mock_redis/blob/v0.46.0/CHANGELOG.md
128
+ documentation_uri: https://www.rubydoc.info/gems/mock_redis/0.46.0
129
129
  homepage_uri: https://github.com/sds/mock_redis
130
- source_code_uri: https://github.com/sds/mock_redis/tree/v0.44.0
131
- post_install_message:
130
+ source_code_uri: https://github.com/sds/mock_redis/tree/v0.46.0
131
+ post_install_message:
132
132
  rdoc_options: []
133
133
  require_paths:
134
134
  - lib
@@ -143,8 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.0.3.1
147
- signing_key:
146
+ rubygems_version: 3.5.9
147
+ signing_key:
148
148
  specification_version: 4
149
149
  summary: Redis mock that just lives in memory; useful for testing.
150
150
  test_files: []