mock_redis 0.50.0 → 0.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ebac8e6fd9d4e182a49424a808557b615e6e38826d2d2db7ae93b1b04ccde99
4
- data.tar.gz: bd088b4ef698618171b361c1f3adfd54a3e9c204abc06a5b1f8668dad1edf65f
3
+ metadata.gz: 9e933ae58d27e242f827d68d17dc8361327ce7c662cba7973ca4a44c4c9265a7
4
+ data.tar.gz: f9bd080555a7c7f3aaec09d5e55327281b3a2860d5045d4e172812def4ea8c82
5
5
  SHA512:
6
- metadata.gz: ea51c2b29a803c5621d5dbd8261fa67436f94f53522fb7b143e7846c699a1c9d6946e69bf2cfc0b374548b238f0272d69014eba70d36ade7eef05512b55325ec
7
- data.tar.gz: 9bbb1f219a89c020242949cc43b00c0324dc56082348c543089fa87cd56499d4873c92fda288d9cf5cc1a3e7e99eb40bcc52a60b46bc74e9a35ec97caca3c2ce
6
+ metadata.gz: c09ef4f19dce4b289f5a205a1d34c284d0c78b98969cfeb8aa04eb76d5a10cf41e5d88f8bb2d85332a5d37d66d09c6262bc19f179ffce2e0e754113c8bfdaa71
7
+ data.tar.gz: a8e824ef5dbf40a9406404eb5c8b5e2bd3cde46c0be994f36724be3beac97bb1f2d4168d557ede3c15f3085e8a03f155d4a88f48b83720b28c1779b8ebd5a0a0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # MockRedis Changelog
2
2
 
3
+ ### 0.52.0
4
+
5
+ * Fix handling of `expire*` via `.call`
6
+
7
+ ### 0.51.0
8
+
9
+ * Improve performance of `hmget` when fetching many fields
10
+
3
11
  ### 0.50.0
4
12
 
5
13
  * Allow `#call` to accept array or multiple arguments
@@ -51,7 +51,12 @@ class MockRedis
51
51
  def call(*command, &_block)
52
52
  # allow for single array argument or multiple arguments
53
53
  command = command[0] if command.length == 1
54
- public_send(command[0].downcase, *command[1..])
54
+
55
+ if command[0].downcase.to_s.include?('expire')
56
+ send_expires(command)
57
+ else
58
+ public_send(command[0].downcase, *command[1..])
59
+ end
55
60
  end
56
61
 
57
62
  def auth(_)
@@ -351,6 +356,11 @@ class MockRedis
351
356
  !!Float(str) rescue false
352
357
  end
353
358
 
359
+ def send_expires(command)
360
+ command, key, ttl, option = *command
361
+ public_send(command, key, ttl, option.downcase.to_sym => option)
362
+ end
363
+
354
364
  def should_update_expiration?(expiry, new_expiry, nx:, xx:, lt:, gt:) # rubocop:disable Metrics/ParameterLists
355
365
  return false if nx && expiry || xx && !expiry
356
366
  return false if lt && expiry && new_expiry > expiry
@@ -93,7 +93,7 @@ class MockRedis
93
93
 
94
94
  assert_type(key, *fields)
95
95
  assert_has_args(fields, 'hmget')
96
- fields.map { |f| hget(key, f) }
96
+ with_hash_at(key) { |h| h.values_at(*fields.map(&:to_s)) }
97
97
  end
98
98
 
99
99
  def mapped_hmget(key, *fields)
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  class MockRedis
5
- VERSION = '0.50.0'
5
+ VERSION = '0.52.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mock_redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.50.0
4
+ version: 0.52.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  - Samuel Merritt
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-20 00:00:00.000000000 Z
11
+ date: 2025-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -124,10 +124,10 @@ 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.50.0/CHANGELOG.md
128
- documentation_uri: https://www.rubydoc.info/gems/mock_redis/0.50.0
127
+ changelog_uri: https://github.com/sds/mock_redis/blob/v0.52.0/CHANGELOG.md
128
+ documentation_uri: https://www.rubydoc.info/gems/mock_redis/0.52.0
129
129
  homepage_uri: https://github.com/sds/mock_redis
130
- source_code_uri: https://github.com/sds/mock_redis/tree/v0.50.0
130
+ source_code_uri: https://github.com/sds/mock_redis/tree/v0.52.0
131
131
  rdoc_options: []
132
132
  require_paths:
133
133
  - lib