redis-objects-periodical 0.4.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +8 -3
- data/.rubocop.yml +3 -1
- data/.rubocop_todo.yml +17 -8
- data/CHANGELOG.md +59 -11
- data/Gemfile +4 -4
- data/Gemfile.lock +47 -39
- data/Rakefile +1 -4
- data/lib/redis/objects/periodical/version.rb +1 -1
- data/lib/redis/objects/periodical_hashes.rb +1 -1
- data/lib/redis/objects/periodical_sets.rb +1 -1
- data/lib/redis/recurring_at_intervals/annual.rb +3 -3
- data/lib/redis/recurring_at_intervals/daily.rb +3 -3
- data/lib/redis/recurring_at_intervals/hourly.rb +2 -2
- data/lib/redis/recurring_at_intervals/minutely.rb +2 -2
- data/lib/redis/recurring_at_intervals/monthly.rb +3 -3
- data/lib/redis/recurring_at_intervals/weekly.rb +3 -3
- data/lib/redis/recurring_at_intervals.rb +13 -9
- data/redis-objects-periodical.gemspec +1 -0
- metadata +4 -4
- data/redis-objects-daily-counter.gemspec +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a9f66a51e7b0786e3207daefee47c2ae7a792b512229e6d7b5ac6c40ed4b956
|
4
|
+
data.tar.gz: 38806524dc3b3d67ab62d76c1b3416518eecb2ba301d66c08eea29f3f88da13e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3b3f462b12369d577165c968ce73fdd8d17589654ce553d0a98bf5922ad5a075808154590d7e9dc1b89555438f24bbd3052a2085b17980eb08251ec570cf3df
|
7
|
+
data.tar.gz: f8ef4de2a9b40c7efada26b858edd6cb546693d18e0d2b075b4f80c26f879e06fa79308bc9b9a2fcb509fc5556a4cc3afd6584c799c6725fe87074ff21e1f3d3
|
data/.circleci/config.yml
CHANGED
@@ -12,8 +12,8 @@ references:
|
|
12
12
|
- &ruby_version
|
13
13
|
ruby_version:
|
14
14
|
type: enum
|
15
|
-
enum: ["2.7", "3.0", "3.1"]
|
16
|
-
default: "3.
|
15
|
+
enum: ["2.7", "3.0", "3.1", "3.2"]
|
16
|
+
default: "3.2"
|
17
17
|
|
18
18
|
executors:
|
19
19
|
default:
|
@@ -126,7 +126,7 @@ jobs:
|
|
126
126
|
- code-climate/install
|
127
127
|
- code-climate/sum-coverage:
|
128
128
|
input: codeclimate.*.json
|
129
|
-
parts:
|
129
|
+
parts: 4
|
130
130
|
- code-climate/upload-coverage
|
131
131
|
rubocop:
|
132
132
|
parameters:
|
@@ -168,6 +168,9 @@ workflows:
|
|
168
168
|
- build:
|
169
169
|
name: build_on_ruby_3.1
|
170
170
|
ruby_version: "3.1"
|
171
|
+
- build:
|
172
|
+
name: build_on_ruby_3.2
|
173
|
+
ruby_version: "3.2"
|
171
174
|
- rubocop:
|
172
175
|
ruby_version: "2.7"
|
173
176
|
- yardoc
|
@@ -176,12 +179,14 @@ workflows:
|
|
176
179
|
- build_on_ruby_2.7
|
177
180
|
- build_on_ruby_3.0
|
178
181
|
- build_on_ruby_3.1
|
182
|
+
- build_on_ruby_3.2
|
179
183
|
- release:
|
180
184
|
context: RubyGems API Key
|
181
185
|
requires:
|
182
186
|
- build_on_ruby_2.7
|
183
187
|
- build_on_ruby_3.0
|
184
188
|
- build_on_ruby_3.1
|
189
|
+
- build_on_ruby_3.2
|
185
190
|
- rubocop
|
186
191
|
filters:
|
187
192
|
branches:
|
data/.rubocop.yml
CHANGED
@@ -14,7 +14,6 @@ Layout/LineLength:
|
|
14
14
|
Metrics/BlockLength:
|
15
15
|
Exclude:
|
16
16
|
- "spec/**/*"
|
17
|
-
- "redis-objects-daily-counter.gemspec"
|
18
17
|
- "redis-objects-periodical.gemspec"
|
19
18
|
|
20
19
|
Metrics/MethodLength:
|
@@ -24,6 +23,9 @@ Naming/FileName:
|
|
24
23
|
Exclude:
|
25
24
|
- "lib/redis-objects-periodical.rb"
|
26
25
|
|
26
|
+
Style/DocumentDynamicEvalDefinition:
|
27
|
+
Enabled: false
|
28
|
+
|
27
29
|
Style/TrailingCommaInArrayLiteral:
|
28
30
|
EnforcedStyleForMultiline: comma
|
29
31
|
|
data/.rubocop_todo.yml
CHANGED
@@ -1,16 +1,25 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2023-02-08 23:31:05 UTC using RuboCop version 1.45.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
# Configuration parameters:
|
11
|
-
Metrics/AbcSize:
|
12
|
-
Max: 21
|
13
|
-
|
14
|
-
# Offense count: 41
|
9
|
+
# Offense count: 12
|
10
|
+
# Configuration parameters: AllowedConstants.
|
15
11
|
Style/Documentation:
|
16
|
-
|
12
|
+
Exclude:
|
13
|
+
- 'spec/**/*'
|
14
|
+
- 'test/**/*'
|
15
|
+
- 'lib/redis-objects-periodical.rb'
|
16
|
+
- 'lib/redis/base_counter_object.rb'
|
17
|
+
- 'lib/redis/base_hash_key_object.rb'
|
18
|
+
- 'lib/redis/base_set_object.rb'
|
19
|
+
- 'lib/redis/recurring_at_intervals.rb'
|
20
|
+
- 'lib/redis/recurring_at_intervals/annual.rb'
|
21
|
+
- 'lib/redis/recurring_at_intervals/daily.rb'
|
22
|
+
- 'lib/redis/recurring_at_intervals/hourly.rb'
|
23
|
+
- 'lib/redis/recurring_at_intervals/minutely.rb'
|
24
|
+
- 'lib/redis/recurring_at_intervals/monthly.rb'
|
25
|
+
- 'lib/redis/recurring_at_intervals/weekly.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,38 +1,86 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## v0.6.0 (Feb 12, 2023)
|
4
|
+
|
5
|
+
### Feature
|
6
|
+
|
7
|
+
- [#125](https://github.com/ryz310/redis-object-daily-counter/pull/125) Support Ruby 3.2 ([@ryz310](https://github.com/ryz310))
|
8
|
+
|
9
|
+
### Rubocop Challenge
|
10
|
+
|
11
|
+
- [#104](https://github.com/ryz310/redis-object-daily-counter/pull/104) Style/RedundantStringEscape-20221214233055 ([@ryz310](https://github.com/ryz310))
|
12
|
+
- [#124](https://github.com/ryz310/redis-object-daily-counter/pull/124) Re-generate .rubocop_todo.yml with RuboCop v1.45.1 ([@ryz310](https://github.com/ryz310))
|
13
|
+
|
14
|
+
### Dependabot
|
15
|
+
|
16
|
+
- [#70](https://github.com/ryz310/redis-object-daily-counter/pull/70) Bump rspec from 3.11.0 to 3.12.0 ([@ryz310](https://github.com/ryz310))
|
17
|
+
- [#101](https://github.com/ryz310/redis-object-daily-counter/pull/101) Bump timecop from 0.9.5 to 0.9.6 ([@ryz310](https://github.com/ryz310))
|
18
|
+
- [#109](https://github.com/ryz310/redis-object-daily-counter/pull/109) Bump rubocop-performance from 1.15.1 to 1.15.2 ([@ryz310](https://github.com/ryz310))
|
19
|
+
- [#110](https://github.com/ryz310/redis-object-daily-counter/pull/110) Bump simplecov from 0.21.2 to 0.22.0 ([@ryz310](https://github.com/ryz310))
|
20
|
+
- [#116](https://github.com/ryz310/redis-object-daily-counter/pull/116) Bump rubocop-rspec from 2.18.0 to 2.18.1 ([@ryz310](https://github.com/ryz310))
|
21
|
+
- [#122](https://github.com/ryz310/redis-object-daily-counter/pull/122) Bump rubocop-performance from 1.15.2 to 1.16.0 ([@ryz310](https://github.com/ryz310))
|
22
|
+
|
23
|
+
## v0.5.0 (Sep 29, 2022)
|
24
|
+
|
25
|
+
### Feature
|
26
|
+
|
27
|
+
- [#34](https://github.com/ryz310/redis-object-daily-counter/pull/34) Enhanced type casting from Time to Date ([@ryz310](https://github.com/ryz310))
|
28
|
+
|
29
|
+
Enhances casting from `Time` to `Date`.
|
30
|
+
|
31
|
+
#### Before
|
32
|
+
|
33
|
+
```rb
|
34
|
+
homepage = Homepage.new
|
35
|
+
homepage.daily_active_users[Date.new(2021, 4, 1)] # OK
|
36
|
+
homepage.daily_active_users[Time.local(2021, 4, 1, 0, 0, 0)] # Error!
|
37
|
+
```
|
38
|
+
|
39
|
+
#### After
|
40
|
+
|
41
|
+
```rb
|
42
|
+
homepage = Homepage.new
|
43
|
+
homepage.daily_active_users[Date.new(2021, 4, 1)] # OK
|
44
|
+
homepage.daily_active_users[Time.local(2021, 4, 1, 0, 0, 0)] # OK
|
45
|
+
```
|
46
|
+
|
47
|
+
### Misc
|
48
|
+
|
49
|
+
- [#25](https://github.com/ryz310/redis-object-daily-counter/pull/25) Remove needless files ([@ryz310](https://github.com/ryz310))
|
50
|
+
|
3
51
|
## v0.4.1 (Jul 27, 2022)
|
4
52
|
|
5
53
|
### Misc
|
6
54
|
|
7
|
-
- [#22](https://github.com/ryz310/redis-
|
55
|
+
- [#22](https://github.com/ryz310/redis-objects-periodical/pull/22) Rename from redis-object-daily-counter to redis-objects-periodical ([@ryz310](https://github.com/ryz310))
|
8
56
|
|
9
57
|
## v0.4.0 (Jul 26, 2022)
|
10
58
|
|
11
59
|
### Feature
|
12
60
|
|
13
|
-
- [#17](https://github.com/ryz310/redis-
|
61
|
+
- [#17](https://github.com/ryz310/redis-objects-periodical/pull/17) Support `Redis::HashKey` as a recurring object ([@ryz310](https://github.com/ryz310))
|
14
62
|
|
15
63
|
### Breaking Change
|
16
64
|
|
17
|
-
- [#18](https://github.com/ryz310/redis-
|
65
|
+
- [#18](https://github.com/ryz310/redis-objects-periodical/pull/18) Bump up Ruby 3.1 and drop support Ruby 2.6 ([@ryz310](https://github.com/ryz310))
|
18
66
|
|
19
67
|
### Dependabot
|
20
68
|
|
21
|
-
- [#16](https://github.com/ryz310/redis-
|
22
|
-
- [#15](https://github.com/ryz310/redis-
|
23
|
-
- [#13](https://github.com/ryz310/redis-
|
24
|
-
- [#14](https://github.com/ryz310/redis-
|
25
|
-
- [#12](https://github.com/ryz310/redis-
|
69
|
+
- [#16](https://github.com/ryz310/redis-objects-periodical/pull/16) Bump yard from 0.9.26 to 0.9.28 ([@ryz310](https://github.com/ryz310))
|
70
|
+
- [#15](https://github.com/ryz310/redis-objects-periodical/pull/15) Bump rspec_junit_formatter from 0.4.1 to 0.5.1 ([@ryz310](https://github.com/ryz310))
|
71
|
+
- [#13](https://github.com/ryz310/redis-objects-periodical/pull/13) Bump rspec from 3.10.0 to 3.11.0 ([@ryz310](https://github.com/ryz310))
|
72
|
+
- [#14](https://github.com/ryz310/redis-objects-periodical/pull/14) Bump timecop from 0.9.4 to 0.9.5 ([@ryz310](https://github.com/ryz310))
|
73
|
+
- [#12](https://github.com/ryz310/redis-objects-periodical/pull/12) Bump redis-objects from 1.5.1 to 1.7.0 ([@ryz310](https://github.com/ryz310))
|
26
74
|
|
27
75
|
### Misc
|
28
76
|
|
29
|
-
- [#19](https://github.com/ryz310/redis-
|
77
|
+
- [#19](https://github.com/ryz310/redis-objects-periodical/pull/19) Reduce similar source codes with meta programming ([@ryz310](https://github.com/ryz310))
|
30
78
|
|
31
79
|
## v0.3.0 (Sep 23, 2021)
|
32
80
|
|
33
81
|
### Feature
|
34
82
|
|
35
|
-
- [#7](https://github.com/ryz310/redis-
|
83
|
+
- [#7](https://github.com/ryz310/redis-objects-periodical/pull/7) Add daily set ([@ryz310](https://github.com/ryz310))
|
36
84
|
|
37
85
|
> You can use `daily_set` in addition to the standard features of Redis::Objects.
|
38
86
|
>
|
@@ -75,7 +123,7 @@
|
|
75
123
|
|
76
124
|
### Breaking Change
|
77
125
|
|
78
|
-
- [#7](https://github.com/ryz310/redis-
|
126
|
+
- [#7](https://github.com/ryz310/redis-objects-periodical/pull/7) Add daily set ([@ryz310](https://github.com/ryz310))
|
79
127
|
|
80
128
|
> Rename the method from #delete to #delete_at a73251f
|
81
129
|
>
|
data/Gemfile
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in redis-objects-periodical.gemspec
|
6
|
-
gemspec
|
6
|
+
gemspec
|
7
7
|
|
8
8
|
gem 'bundler', '>= 2.0'
|
9
9
|
gem 'pry-byebug'
|
10
10
|
gem 'rake', '~> 13.0'
|
11
|
-
gem 'rspec', '~> 3.
|
11
|
+
gem 'rspec', '~> 3.12'
|
12
12
|
gem 'rspec_junit_formatter'
|
13
|
-
gem 'rubocop', '~>
|
13
|
+
gem 'rubocop', '~> 1.36'
|
14
14
|
gem 'rubocop-performance'
|
15
15
|
gem 'rubocop-rspec'
|
16
|
-
gem 'simplecov', '0.
|
16
|
+
gem 'simplecov', '0.22.0'
|
17
17
|
gem 'timecop'
|
18
18
|
gem 'yard'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
redis-objects-periodical (0.
|
4
|
+
redis-objects-periodical (0.6.0)
|
5
5
|
redis-objects
|
6
6
|
|
7
7
|
GEM
|
@@ -10,66 +10,74 @@ GEM
|
|
10
10
|
ast (2.4.2)
|
11
11
|
byebug (11.1.3)
|
12
12
|
coderay (1.1.3)
|
13
|
+
connection_pool (2.3.0)
|
13
14
|
diff-lcs (1.5.0)
|
14
15
|
docile (1.4.0)
|
16
|
+
json (2.6.3)
|
15
17
|
method_source (1.0.0)
|
16
18
|
parallel (1.22.1)
|
17
|
-
parser (3.1.
|
19
|
+
parser (3.2.1.0)
|
18
20
|
ast (~> 2.4.1)
|
19
|
-
pry (0.
|
21
|
+
pry (0.14.2)
|
20
22
|
coderay (~> 1.1)
|
21
23
|
method_source (~> 1.0)
|
22
|
-
pry-byebug (3.
|
24
|
+
pry-byebug (3.10.1)
|
23
25
|
byebug (~> 11.0)
|
24
|
-
pry (
|
26
|
+
pry (>= 0.13, < 0.15)
|
25
27
|
rainbow (3.1.1)
|
26
28
|
rake (13.0.6)
|
27
|
-
redis (
|
29
|
+
redis (5.0.6)
|
30
|
+
redis-client (>= 0.9.0)
|
31
|
+
redis-client (0.12.1)
|
32
|
+
connection_pool
|
28
33
|
redis-objects (1.7.0)
|
29
34
|
redis
|
30
|
-
regexp_parser (2.
|
35
|
+
regexp_parser (2.7.0)
|
31
36
|
rexml (3.2.5)
|
32
|
-
rspec (3.
|
33
|
-
rspec-core (~> 3.
|
34
|
-
rspec-expectations (~> 3.
|
35
|
-
rspec-mocks (~> 3.
|
36
|
-
rspec-core (3.
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-expectations (3.
|
37
|
+
rspec (3.12.0)
|
38
|
+
rspec-core (~> 3.12.0)
|
39
|
+
rspec-expectations (~> 3.12.0)
|
40
|
+
rspec-mocks (~> 3.12.0)
|
41
|
+
rspec-core (3.12.1)
|
42
|
+
rspec-support (~> 3.12.0)
|
43
|
+
rspec-expectations (3.12.2)
|
39
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-mocks (3.
|
45
|
+
rspec-support (~> 3.12.0)
|
46
|
+
rspec-mocks (3.12.3)
|
42
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-support (3.
|
45
|
-
rspec_junit_formatter (0.
|
48
|
+
rspec-support (~> 3.12.0)
|
49
|
+
rspec-support (3.12.0)
|
50
|
+
rspec_junit_formatter (0.6.0)
|
46
51
|
rspec-core (>= 2, < 4, != 2.12.0)
|
47
|
-
rubocop (
|
52
|
+
rubocop (1.45.1)
|
53
|
+
json (~> 2.3)
|
48
54
|
parallel (~> 1.10)
|
49
|
-
parser (>= 2.
|
55
|
+
parser (>= 3.2.0.0)
|
50
56
|
rainbow (>= 2.2.2, < 4.0)
|
51
|
-
regexp_parser (>= 1.8)
|
52
|
-
rexml
|
53
|
-
rubocop-ast (>=
|
57
|
+
regexp_parser (>= 1.8, < 3.0)
|
58
|
+
rexml (>= 3.2.5, < 4.0)
|
59
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
54
60
|
ruby-progressbar (~> 1.7)
|
55
|
-
unicode-display_width (>=
|
56
|
-
rubocop-ast (1.
|
57
|
-
parser (>= 3.
|
58
|
-
rubocop-
|
59
|
-
rubocop (
|
61
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
62
|
+
rubocop-ast (1.26.0)
|
63
|
+
parser (>= 3.2.1.0)
|
64
|
+
rubocop-capybara (2.17.0)
|
65
|
+
rubocop (~> 1.41)
|
66
|
+
rubocop-performance (1.16.0)
|
67
|
+
rubocop (>= 1.7.0, < 2.0)
|
60
68
|
rubocop-ast (>= 0.4.0)
|
61
|
-
rubocop-rspec (
|
62
|
-
rubocop (~>
|
63
|
-
rubocop-
|
69
|
+
rubocop-rspec (2.18.1)
|
70
|
+
rubocop (~> 1.33)
|
71
|
+
rubocop-capybara (~> 2.17)
|
64
72
|
ruby-progressbar (1.11.0)
|
65
|
-
simplecov (0.
|
73
|
+
simplecov (0.22.0)
|
66
74
|
docile (~> 1.1)
|
67
75
|
simplecov-html (~> 0.11)
|
68
76
|
simplecov_json_formatter (~> 0.1)
|
69
77
|
simplecov-html (0.12.3)
|
70
78
|
simplecov_json_formatter (0.1.4)
|
71
|
-
timecop (0.9.
|
72
|
-
unicode-display_width (
|
79
|
+
timecop (0.9.6)
|
80
|
+
unicode-display_width (2.4.2)
|
73
81
|
webrick (1.7.0)
|
74
82
|
yard (0.9.28)
|
75
83
|
webrick (~> 1.7.0)
|
@@ -85,14 +93,14 @@ DEPENDENCIES
|
|
85
93
|
pry-byebug
|
86
94
|
rake (~> 13.0)
|
87
95
|
redis-objects-periodical!
|
88
|
-
rspec (~> 3.
|
96
|
+
rspec (~> 3.12)
|
89
97
|
rspec_junit_formatter
|
90
|
-
rubocop (~>
|
98
|
+
rubocop (~> 1.36)
|
91
99
|
rubocop-performance
|
92
100
|
rubocop-rspec
|
93
|
-
simplecov (= 0.
|
101
|
+
simplecov (= 0.22.0)
|
94
102
|
timecop
|
95
103
|
yard
|
96
104
|
|
97
105
|
BUNDLED WITH
|
98
|
-
2.3.
|
106
|
+
2.3.26
|
data/Rakefile
CHANGED
@@ -5,13 +5,13 @@ class Redis
|
|
5
5
|
module Annual
|
6
6
|
private
|
7
7
|
|
8
|
-
def
|
8
|
+
def redis_periodical_field_key(date_or_time)
|
9
9
|
date_key = date_or_time.strftime('%Y')
|
10
10
|
[original_key, date_key].flatten.join(':')
|
11
11
|
end
|
12
12
|
|
13
|
-
def next_key(
|
14
|
-
|
13
|
+
def next_key(date_or_time, length = 1)
|
14
|
+
date_or_time.to_date.next_year(length)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -5,13 +5,13 @@ class Redis
|
|
5
5
|
module Daily
|
6
6
|
private
|
7
7
|
|
8
|
-
def
|
8
|
+
def redis_periodical_field_key(date_or_time)
|
9
9
|
date_key = date_or_time.strftime('%Y-%m-%d')
|
10
10
|
[original_key, date_key].flatten.join(':')
|
11
11
|
end
|
12
12
|
|
13
|
-
def next_key(
|
14
|
-
|
13
|
+
def next_key(date_or_time, length = 1)
|
14
|
+
date_or_time.to_date + length
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -5,13 +5,13 @@ class Redis
|
|
5
5
|
module Hourly
|
6
6
|
private
|
7
7
|
|
8
|
-
def
|
8
|
+
def redis_periodical_field_key(time)
|
9
9
|
time_key = time.strftime('%Y-%m-%dT%H')
|
10
10
|
[original_key, time_key].flatten.join(':')
|
11
11
|
end
|
12
12
|
|
13
13
|
def next_key(time, length = 1)
|
14
|
-
time + 3600 * length
|
14
|
+
time + (3600 * length)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -5,13 +5,13 @@ class Redis
|
|
5
5
|
module Minutely
|
6
6
|
private
|
7
7
|
|
8
|
-
def
|
8
|
+
def redis_periodical_field_key(time)
|
9
9
|
time_key = time.strftime('%Y-%m-%dT%H:%M')
|
10
10
|
[original_key, time_key].flatten.join(':')
|
11
11
|
end
|
12
12
|
|
13
13
|
def next_key(time, length = 1)
|
14
|
-
time + 60 * length
|
14
|
+
time + (60 * length)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -5,13 +5,13 @@ class Redis
|
|
5
5
|
module Monthly
|
6
6
|
private
|
7
7
|
|
8
|
-
def
|
8
|
+
def redis_periodical_field_key(date_or_time)
|
9
9
|
date_key = date_or_time.strftime('%Y-%m')
|
10
10
|
[original_key, date_key].flatten.join(':')
|
11
11
|
end
|
12
12
|
|
13
|
-
def next_key(
|
14
|
-
|
13
|
+
def next_key(date_or_time, length = 1)
|
14
|
+
date_or_time.to_date.next_month(length)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -5,13 +5,13 @@ class Redis
|
|
5
5
|
module Weekly
|
6
6
|
private
|
7
7
|
|
8
|
-
def
|
8
|
+
def redis_periodical_field_key(date_or_time)
|
9
9
|
date_key = date_or_time.strftime('%YW%W')
|
10
10
|
[original_key, date_key].flatten.join(':')
|
11
11
|
end
|
12
12
|
|
13
|
-
def next_key(
|
14
|
-
|
13
|
+
def next_key(date_or_time, length = 1)
|
14
|
+
date_or_time.to_date + (7 * length)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -4,7 +4,7 @@ class Redis
|
|
4
4
|
module RecurringAtIntervals
|
5
5
|
def initialize(key, *args)
|
6
6
|
@original_key = key
|
7
|
-
super(
|
7
|
+
super(redis_periodical_field_key(current_time), *args)
|
8
8
|
end
|
9
9
|
|
10
10
|
attr_reader :original_key
|
@@ -19,23 +19,23 @@ class Redis
|
|
19
19
|
when -1 then nil # Ruby does this (a bit weird)
|
20
20
|
end
|
21
21
|
else
|
22
|
-
get_value_from_redis(
|
22
|
+
get_value_from_redis(redis_periodical_field_key(date_or_time))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
alias slice []
|
26
26
|
|
27
27
|
def delete_at(date_or_time)
|
28
|
-
delete_from_redis(
|
28
|
+
delete_from_redis(redis_periodical_field_key(date_or_time))
|
29
29
|
end
|
30
30
|
|
31
31
|
def range(start_date_or_time, end_date_or_time)
|
32
32
|
keys = []
|
33
|
-
date_or_time = start_date_or_time
|
33
|
+
date_or_time = normalize(start_date_or_time)
|
34
34
|
|
35
35
|
loop do
|
36
|
-
break if date_or_time > end_date_or_time
|
36
|
+
break if date_or_time > normalize(end_date_or_time)
|
37
37
|
|
38
|
-
keys <<
|
38
|
+
keys << redis_periodical_field_key(date_or_time)
|
39
39
|
date_or_time = next_key(date_or_time)
|
40
40
|
end
|
41
41
|
|
@@ -43,7 +43,7 @@ class Redis
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def at(date_or_time)
|
46
|
-
get_redis_object(
|
46
|
+
get_redis_object(redis_periodical_field_key(date_or_time))
|
47
47
|
end
|
48
48
|
|
49
49
|
def current_time
|
@@ -68,12 +68,16 @@ class Redis
|
|
68
68
|
raise 'not implemented'
|
69
69
|
end
|
70
70
|
|
71
|
-
def
|
71
|
+
def redis_periodical_field_key(_date_or_time)
|
72
72
|
raise 'not implemented'
|
73
73
|
end
|
74
74
|
|
75
|
-
def next_key(
|
75
|
+
def next_key(_date_or_time, _length = 1)
|
76
76
|
raise 'not implemented'
|
77
77
|
end
|
78
|
+
|
79
|
+
def normalize(date_or_time)
|
80
|
+
next_key(date_or_time, 0)
|
81
|
+
end
|
78
82
|
end
|
79
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-objects-periodical
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryz310
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-objects
|
@@ -68,7 +68,6 @@ files:
|
|
68
68
|
- lib/redis/recurring_at_intervals/minutely.rb
|
69
69
|
- lib/redis/recurring_at_intervals/monthly.rb
|
70
70
|
- lib/redis/recurring_at_intervals/weekly.rb
|
71
|
-
- redis-objects-daily-counter.gemspec
|
72
71
|
- redis-objects-periodical.gemspec
|
73
72
|
homepage: https://github.com/ryz310/redis-objects-periodical
|
74
73
|
licenses:
|
@@ -77,6 +76,7 @@ metadata:
|
|
77
76
|
homepage_uri: https://github.com/ryz310/redis-objects-periodical
|
78
77
|
source_code_uri: https://github.com/ryz310/redis-objects-periodical
|
79
78
|
changelog_uri: https://github.com/ryz310/redis-objects-periodical/blob/master/CHANGELOG.md
|
79
|
+
rubygems_mfa_required: 'true'
|
80
80
|
post_install_message:
|
81
81
|
rdoc_options: []
|
82
82
|
require_paths:
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
95
|
+
rubygems_version: 3.4.6
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Extends Redis::Objects as periodical.
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'redis-objects-daily-counter'
|
5
|
-
spec.version = '0.4.1'
|
6
|
-
spec.authors = ['ryz310']
|
7
|
-
spec.email = ['ryz310@gmail.com']
|
8
|
-
|
9
|
-
spec.summary = 'Daily counter within Redis::Objects'
|
10
|
-
spec.description = 'Daily counter within Redis::Objects. Works with any class or ORM.'
|
11
|
-
spec.post_install_message = 'The redis-objects-daily-counter gem has been deprecated and has '\
|
12
|
-
'been replaced by redis-objects-periodical. Please switch to '\
|
13
|
-
'redis-objects-periodical as soon as possible.'
|
14
|
-
spec.homepage = 'https://github.com/ryz310/redis-objects-daily-counter'
|
15
|
-
spec.license = 'MIT'
|
16
|
-
|
17
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
-
spec.metadata['source_code_uri'] = 'https://github.com/ryz310/redis-objects-daily-counter'
|
19
|
-
spec.metadata['changelog_uri'] = 'https://github.com/ryz310/redis-objects-daily-counter/blob/master/CHANGELOG.md'
|
20
|
-
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
25
|
-
end
|
26
|
-
spec.bindir = 'exe'
|
27
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ['lib']
|
29
|
-
|
30
|
-
spec.required_ruby_version = '>= 2.7.0'
|
31
|
-
|
32
|
-
spec.add_dependency 'redis-objects'
|
33
|
-
|
34
|
-
# For more information and examples about making a new gem, checkout our
|
35
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
36
|
-
end
|