mock_redis 0.43.0 → 0.45.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 +8 -0
- data/README.md +6 -7
- data/lib/mock_redis/database.rb +2 -0
- data/lib/mock_redis/list_methods.rb +7 -2
- data/lib/mock_redis/memory_method.rb +11 -0
- data/lib/mock_redis/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d1b68c8d02b25dcd30e463797ca26ad87142cbba1e85f43ef635e59adc1b6f2
|
4
|
+
data.tar.gz: 7daf9875e33a704d73917a83d71878ea931671c5a34d4382b3b8f888b98c18ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60b2f391b1ce3e8bce7986bdc19918c5ef5f8453bcea9ffc0ced69e61fd8233ade6c93a9efa71aff4ec7f8b348b8737a1347bb2494f7d5f6587c32a2c4698a18
|
7
|
+
data.tar.gz: 9dd87f2dfae5a2fd7e97cbc3f8396b70f5cc6f30d29d1c9f3b5849b60b7180d02a32a17e8686f9cdc716cbb44d04ae411839aaa518d4da70cc07cca9b1893f66
|
data/CHANGELOG.md
CHANGED
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
data/lib/mock_redis/database.rb
CHANGED
@@ -12,6 +12,7 @@ require 'mock_redis/utility_methods'
|
|
12
12
|
require 'mock_redis/geospatial_methods'
|
13
13
|
require 'mock_redis/stream_methods'
|
14
14
|
require 'mock_redis/connection_method'
|
15
|
+
require 'mock_redis/memory_method'
|
15
16
|
|
16
17
|
class MockRedis
|
17
18
|
class Database
|
@@ -26,6 +27,7 @@ class MockRedis
|
|
26
27
|
include GeospatialMethods
|
27
28
|
include StreamMethods
|
28
29
|
include ConnectionMethod
|
30
|
+
include MemoryMethod
|
29
31
|
|
30
32
|
attr_reader :data, :expire_times
|
31
33
|
|
@@ -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)
|
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.45.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-09-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- lib/mock_redis/indifferent_hash.rb
|
105
105
|
- lib/mock_redis/info_method.rb
|
106
106
|
- lib/mock_redis/list_methods.rb
|
107
|
+
- lib/mock_redis/memory_method.rb
|
107
108
|
- lib/mock_redis/multi_db_wrapper.rb
|
108
109
|
- lib/mock_redis/pipelined_wrapper.rb
|
109
110
|
- lib/mock_redis/set_methods.rb
|
@@ -123,10 +124,10 @@ licenses:
|
|
123
124
|
- MIT
|
124
125
|
metadata:
|
125
126
|
bug_tracker_uri: https://github.com/sds/mock_redis/issues
|
126
|
-
changelog_uri: https://github.com/sds/mock_redis/blob/v0.
|
127
|
-
documentation_uri: https://www.rubydoc.info/gems/mock_redis/0.
|
127
|
+
changelog_uri: https://github.com/sds/mock_redis/blob/v0.45.0/CHANGELOG.md
|
128
|
+
documentation_uri: https://www.rubydoc.info/gems/mock_redis/0.45.0
|
128
129
|
homepage_uri: https://github.com/sds/mock_redis
|
129
|
-
source_code_uri: https://github.com/sds/mock_redis/tree/v0.
|
130
|
+
source_code_uri: https://github.com/sds/mock_redis/tree/v0.45.0
|
130
131
|
post_install_message:
|
131
132
|
rdoc_options: []
|
132
133
|
require_paths:
|
@@ -142,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
143
|
- !ruby/object:Gem::Version
|
143
144
|
version: '0'
|
144
145
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
146
|
+
rubygems_version: 3.5.9
|
146
147
|
signing_key:
|
147
148
|
specification_version: 4
|
148
149
|
summary: Redis mock that just lives in memory; useful for testing.
|