izanami 0.19.0 → 0.20.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 +8 -8
- data/lib/izanami/mappers/command.rb +27 -4
- data/lib/izanami/version.rb +1 -1
- data/spec/izanami/mappers/command_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmQ0ODM0MjA1MzFiNWRhNDI3MDA2MjUwZTE0ZGM5ZmYyN2EyZjFiMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWI2OGIyY2IyYmY1ZmYzMDU2ODgwY2I0OTJlYWUzYjJiN2RlZDA3Nw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmQwNTFmMjVmZjFkMWRiYTI5ZTg5M2I1MDNkM2VjZmI0YTA5OWUwZjJkYjFh
|
10
|
+
YTNlZGU5ZTBmYjZhMjZkZmJjZjI2Y2VjNjdjZTk1MzdlYTZhNGEyYTUwZDRl
|
11
|
+
MjQxMzc2NjA0MmFlMjdlMTVlOTU0Y2I0N2ZmZTAzMzA0OGQxYjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YThiMmJjOWQ3N2YxYzk2NDQ4ZTYzYjNhNTEzYTc4ZGJhNWU3OGYwMTMzNWY1
|
14
|
+
NjQzYjY3YzVmZTU2ZjAwOTM0MWZmNGU0YWQ3YTllYjA1ODcxYmYzYWExOTYx
|
15
|
+
YzY4ZTkwZjFkZWZhODI2YjczNDNmM2ViYzI0MDFlZmY4ZDgzNDA=
|
@@ -50,7 +50,7 @@ module Izanami
|
|
50
50
|
# @return [Array] all the commands found.
|
51
51
|
def take(number)
|
52
52
|
options = { order: 'DESC', limit: [0, number] }
|
53
|
-
client.sort('ids', options).map { |id| find(id) }
|
53
|
+
client.sort('ids', options).map { |id| find(id) }.compact
|
54
54
|
end
|
55
55
|
|
56
56
|
# Delete the specified commands
|
@@ -58,14 +58,37 @@ module Izanami
|
|
58
58
|
# @param [Array] ids the commands' ids.
|
59
59
|
def delete(ids)
|
60
60
|
client.multi do
|
61
|
-
|
62
|
-
|
61
|
+
delete_commands ids
|
62
|
+
delete_ids ids
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
# Delete the commands' attributes.
|
67
|
+
#
|
68
|
+
# @param [Array] ids the commands' ids.
|
69
|
+
def delete_commands(ids)
|
70
|
+
client.del(ids)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Delete the commands' ids from the global IDs set.
|
74
|
+
#
|
75
|
+
# @param [Array] ids the commands' ids.
|
76
|
+
def delete_ids(ids)
|
77
|
+
client.srem('ids', ids)
|
78
|
+
end
|
79
|
+
|
66
80
|
# Delete all commands
|
81
|
+
#
|
82
|
+
# @see {#delete}
|
67
83
|
def delete_all
|
68
|
-
delete
|
84
|
+
delete stored_ids
|
85
|
+
end
|
86
|
+
|
87
|
+
# Retrieve all stored IDs
|
88
|
+
#
|
89
|
+
# @return [Array] all the ids as Strings.
|
90
|
+
def stored_ids
|
91
|
+
client.smembers('ids')
|
69
92
|
end
|
70
93
|
|
71
94
|
# Save the hash as a command.
|
data/lib/izanami/version.rb
CHANGED
@@ -84,6 +84,19 @@ describe Izanami::Mappers do
|
|
84
84
|
it 'takes the elements sorted by their ids' do
|
85
85
|
subject.take(3).should == commands.take(3)
|
86
86
|
end
|
87
|
+
|
88
|
+
context 'when the IDs are inconsistent' do
|
89
|
+
before do
|
90
|
+
# remove the commands' data, but not their IDs,
|
91
|
+
# like they have been expired by redis
|
92
|
+
ids = commands.map { |c| c['id'] }
|
93
|
+
subject.send(:delete_commands, ids)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'takes zero commands' do
|
97
|
+
subject.take(3).should be_empty
|
98
|
+
end
|
99
|
+
end
|
87
100
|
end
|
88
101
|
|
89
102
|
describe '#count' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: izanami
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Hernández
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|