redis-objects-periodical 0.5.0 → 0.7.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 +4 -4
- data/.circleci/config.yml +8 -3
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +18 -8
- data/CHANGELOG.md +60 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +42 -38
- data/README.md +41 -0
- data/lib/redis/base_value_object.rb +27 -0
- 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/objects/periodical_values.rb +44 -0
- data/lib/redis/periodical_value.rb +15 -0
- data/lib/redis/recurring_at_intervals/hourly.rb +1 -1
- data/lib/redis/recurring_at_intervals/minutely.rb +1 -1
- data/lib/redis/recurring_at_intervals/weekly.rb +1 -1
- data/lib/redis-objects-periodical.rb +3 -0
- data/redis-objects-periodical.gemspec +2 -1
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be8af0088e6ff4a0d8e8e26185acd940452d08f123b1820eef198f636db7b1f7
|
4
|
+
data.tar.gz: 3cd7b2fbb4ea2fd2bd6e53c3d0798ec4bb1e93b89760a4a6fec48b0215fc072e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 284c3aca951719e4efd85195dbd6457061732a1507821b173cf8e61e879e75fc751694b2540b6716b087ec311ad71c3c9e6d59a29f46f25552e0ae5586baf715
|
7
|
+
data.tar.gz: 5fafbcc175c1303535e6e23ee9df14f41a1db5006515416171f15e73f38ee5192e6a0b9adfa6fdfb1ef94c351768bd543c7d9b08e1ce8d1e1de0ac84f621ae1b
|
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
data/.rubocop_todo.yml
CHANGED
@@ -1,16 +1,26 @@
|
|
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/base_value_object.rb"
|
20
|
+
- "lib/redis/recurring_at_intervals.rb"
|
21
|
+
- "lib/redis/recurring_at_intervals/annual.rb"
|
22
|
+
- "lib/redis/recurring_at_intervals/daily.rb"
|
23
|
+
- "lib/redis/recurring_at_intervals/hourly.rb"
|
24
|
+
- "lib/redis/recurring_at_intervals/minutely.rb"
|
25
|
+
- "lib/redis/recurring_at_intervals/monthly.rb"
|
26
|
+
- "lib/redis/recurring_at_intervals/weekly.rb"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,65 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## v0.7.0 (Feb 12, 2023)
|
4
|
+
|
5
|
+
### Feature
|
6
|
+
|
7
|
+
- [#128](https://github.com/ryz310/redis-object-daily-counter/pull/128) Support`Redis::Value` as a periodical object ([@ryz310](https://github.com/ryz310))
|
8
|
+
|
9
|
+
> The periodical values automatically switches the save destination when the date changes.
|
10
|
+
>
|
11
|
+
> ```rb
|
12
|
+
> class Homepage
|
13
|
+
> include Redis::Objects
|
14
|
+
>
|
15
|
+
> daily_value :cache, expireat: -> { Time.now + 2_678_400 } # about a month
|
16
|
+
>
|
17
|
+
> def id
|
18
|
+
> 1
|
19
|
+
> end
|
20
|
+
> end
|
21
|
+
>
|
22
|
+
> homepage = Homepage.new
|
23
|
+
>
|
24
|
+
> # 2021-04-01
|
25
|
+
> homepage.cache.value = 'a'
|
26
|
+
>
|
27
|
+
> # 2021-04-02 (next day)
|
28
|
+
> homepage.cache.value = 'b'
|
29
|
+
>
|
30
|
+
> # 2021-04-03 (next day)
|
31
|
+
> homepage.cache.value = 'c'
|
32
|
+
>
|
33
|
+
> homepage.cache[Date.new(2021, 4, 1)] # => 'a'
|
34
|
+
> homepage.cache[Date.new(2021, 4, 1), 3] # => ['a', 'b', 'c']
|
35
|
+
> homepage.cache[Date.new(2021, 4, 1)..Date.new(2021, 4, 2)] # => ['a', 'b']
|
36
|
+
>
|
37
|
+
> homepage.cache.delete_at(Date.new(2021, 4, 1))
|
38
|
+
> homepage.cache.range(Date.new(2021, 4, 1), Date.new(2021, 4, 3)) # => [nil, 'b', 'c']
|
39
|
+
> homepage.cache.at(Date.new(2021, 4, 2)) # => #<Redis::Value key="homepage:1:cache:2021-04-02">
|
40
|
+
> homepage.cache.at(Date.new(2021, 4, 2)).value # 'b'
|
41
|
+
> ```
|
42
|
+
|
43
|
+
## v0.6.0 (Feb 12, 2023)
|
44
|
+
|
45
|
+
### Feature
|
46
|
+
|
47
|
+
- [#125](https://github.com/ryz310/redis-object-daily-counter/pull/125) Support Ruby 3.2 ([@ryz310](https://github.com/ryz310))
|
48
|
+
|
49
|
+
### Rubocop Challenge
|
50
|
+
|
51
|
+
- [#104](https://github.com/ryz310/redis-object-daily-counter/pull/104) Style/RedundantStringEscape-20221214233055 ([@ryz310](https://github.com/ryz310))
|
52
|
+
- [#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))
|
53
|
+
|
54
|
+
### Dependabot
|
55
|
+
|
56
|
+
- [#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))
|
57
|
+
- [#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))
|
58
|
+
- [#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))
|
59
|
+
- [#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))
|
60
|
+
- [#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))
|
61
|
+
- [#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))
|
62
|
+
|
3
63
|
## v0.5.0 (Sep 29, 2022)
|
4
64
|
|
5
65
|
### Feature
|
data/Gemfile
CHANGED
@@ -8,11 +8,11 @@ gemspec
|
|
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,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
redis-objects-periodical (0.
|
5
|
-
redis-objects
|
4
|
+
redis-objects-periodical (0.7.0)
|
5
|
+
redis-objects (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -13,11 +13,12 @@ GEM
|
|
13
13
|
connection_pool (2.3.0)
|
14
14
|
diff-lcs (1.5.0)
|
15
15
|
docile (1.4.0)
|
16
|
+
json (2.6.3)
|
16
17
|
method_source (1.0.0)
|
17
18
|
parallel (1.22.1)
|
18
|
-
parser (3.
|
19
|
+
parser (3.2.1.0)
|
19
20
|
ast (~> 2.4.1)
|
20
|
-
pry (0.14.
|
21
|
+
pry (0.14.2)
|
21
22
|
coderay (~> 1.1)
|
22
23
|
method_source (~> 1.0)
|
23
24
|
pry-byebug (3.10.1)
|
@@ -25,55 +26,58 @@ GEM
|
|
25
26
|
pry (>= 0.13, < 0.15)
|
26
27
|
rainbow (3.1.1)
|
27
28
|
rake (13.0.6)
|
28
|
-
redis (5.0.
|
29
|
+
redis (5.0.6)
|
29
30
|
redis-client (>= 0.9.0)
|
30
|
-
redis-client (0.
|
31
|
+
redis-client (0.12.1)
|
31
32
|
connection_pool
|
32
33
|
redis-objects (1.7.0)
|
33
34
|
redis
|
34
|
-
regexp_parser (2.
|
35
|
+
regexp_parser (2.7.0)
|
35
36
|
rexml (3.2.5)
|
36
|
-
rspec (3.
|
37
|
-
rspec-core (~> 3.
|
38
|
-
rspec-expectations (~> 3.
|
39
|
-
rspec-mocks (~> 3.
|
40
|
-
rspec-core (3.
|
41
|
-
rspec-support (~> 3.
|
42
|
-
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)
|
43
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.
|
45
|
-
rspec-mocks (3.
|
45
|
+
rspec-support (~> 3.12.0)
|
46
|
+
rspec-mocks (3.12.3)
|
46
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
-
rspec-support (~> 3.
|
48
|
-
rspec-support (3.
|
48
|
+
rspec-support (~> 3.12.0)
|
49
|
+
rspec-support (3.12.0)
|
49
50
|
rspec_junit_formatter (0.6.0)
|
50
51
|
rspec-core (>= 2, < 4, != 2.12.0)
|
51
|
-
rubocop (
|
52
|
+
rubocop (1.45.1)
|
53
|
+
json (~> 2.3)
|
52
54
|
parallel (~> 1.10)
|
53
|
-
parser (>= 2.
|
55
|
+
parser (>= 3.2.0.0)
|
54
56
|
rainbow (>= 2.2.2, < 4.0)
|
55
|
-
regexp_parser (>= 1.8)
|
56
|
-
rexml
|
57
|
-
rubocop-ast (>=
|
57
|
+
regexp_parser (>= 1.8, < 3.0)
|
58
|
+
rexml (>= 3.2.5, < 4.0)
|
59
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
58
60
|
ruby-progressbar (~> 1.7)
|
59
|
-
unicode-display_width (>=
|
60
|
-
rubocop-ast (1.
|
61
|
-
parser (>= 3.
|
62
|
-
rubocop-
|
63
|
-
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)
|
64
68
|
rubocop-ast (>= 0.4.0)
|
65
|
-
rubocop-rspec (
|
66
|
-
rubocop (~>
|
67
|
-
rubocop-
|
69
|
+
rubocop-rspec (2.18.1)
|
70
|
+
rubocop (~> 1.33)
|
71
|
+
rubocop-capybara (~> 2.17)
|
68
72
|
ruby-progressbar (1.11.0)
|
69
|
-
simplecov (0.
|
73
|
+
simplecov (0.22.0)
|
70
74
|
docile (~> 1.1)
|
71
75
|
simplecov-html (~> 0.11)
|
72
76
|
simplecov_json_formatter (~> 0.1)
|
73
77
|
simplecov-html (0.12.3)
|
74
78
|
simplecov_json_formatter (0.1.4)
|
75
|
-
timecop (0.9.
|
76
|
-
unicode-display_width (
|
79
|
+
timecop (0.9.6)
|
80
|
+
unicode-display_width (2.4.2)
|
77
81
|
webrick (1.7.0)
|
78
82
|
yard (0.9.28)
|
79
83
|
webrick (~> 1.7.0)
|
@@ -89,14 +93,14 @@ DEPENDENCIES
|
|
89
93
|
pry-byebug
|
90
94
|
rake (~> 13.0)
|
91
95
|
redis-objects-periodical!
|
92
|
-
rspec (~> 3.
|
96
|
+
rspec (~> 3.12)
|
93
97
|
rspec_junit_formatter
|
94
|
-
rubocop (~>
|
98
|
+
rubocop (~> 1.36)
|
95
99
|
rubocop-performance
|
96
100
|
rubocop-rspec
|
97
|
-
simplecov (= 0.
|
101
|
+
simplecov (= 0.22.0)
|
98
102
|
timecop
|
99
103
|
yard
|
100
104
|
|
101
105
|
BUNDLED WITH
|
102
|
-
2.3.
|
106
|
+
2.3.26
|
data/README.md
CHANGED
@@ -32,6 +32,7 @@ class Homepage
|
|
32
32
|
daily_counter :pv, expireat: -> { Time.now + 2_678_400 } # about a month
|
33
33
|
daily_hash_key :browsing_history, expireat: -> { Time.now + 2_678_400 } # about a month
|
34
34
|
daily_set :dau, expireat: -> { Time.now + 2_678_400 } # about a month
|
35
|
+
daily_value :cache, expireat: -> { Time.now + 2_678_400 } # about a month
|
35
36
|
|
36
37
|
def id
|
37
38
|
1
|
@@ -99,6 +100,46 @@ homepage.pv.at(Date.new(2021, 4, 2)).value # 2
|
|
99
100
|
- `minutely_counter`
|
100
101
|
- Key format: `model_name:id:field_name:yyyy-mm-ddThh:mi`
|
101
102
|
|
103
|
+
### Periodical Values
|
104
|
+
|
105
|
+
The periodical values automatically switches the save destination when the date changes.
|
106
|
+
|
107
|
+
```rb
|
108
|
+
# 2021-04-01
|
109
|
+
homepage.cache.value = 'a'
|
110
|
+
|
111
|
+
# 2021-04-02 (next day)
|
112
|
+
homepage.cache.value = 'b'
|
113
|
+
|
114
|
+
# 2021-04-03 (next day)
|
115
|
+
homepage.cache.value = 'c'
|
116
|
+
|
117
|
+
homepage.cache[Date.new(2021, 4, 1)] # => 'a'
|
118
|
+
homepage.cache[Date.new(2021, 4, 1), 3] # => ['a', 'b', 'c']
|
119
|
+
homepage.cache[Date.new(2021, 4, 1)..Date.new(2021, 4, 2)] # => ['a', 'b']
|
120
|
+
|
121
|
+
homepage.cache.delete_at(Date.new(2021, 4, 1))
|
122
|
+
homepage.cache.range(Date.new(2021, 4, 1), Date.new(2021, 4, 3)) # => [nil, 'b', 'c']
|
123
|
+
homepage.cache.at(Date.new(2021, 4, 2)) # => #<Redis::Value key="homepage:1:cache:2021-04-02">
|
124
|
+
homepage.cache.at(Date.new(2021, 4, 2)).value # 'b'
|
125
|
+
```
|
126
|
+
|
127
|
+
#### Periodical Values Family
|
128
|
+
|
129
|
+
- `annual_value`
|
130
|
+
- Key format: `model_name:id:field_name:yyyy`
|
131
|
+
- Redis is a highly volatile key-value store, so I don't recommend using it.
|
132
|
+
- `monthly_value`
|
133
|
+
- Key format: `model_name:id:field_name:yyyy-mm`
|
134
|
+
- `weekly_value`
|
135
|
+
- Key format: `model_name:id:field_name:yyyyWw`
|
136
|
+
- `daily_value`
|
137
|
+
- Key format: `model_name:id:field_name:yyyy-mm-dd`
|
138
|
+
- `hourly_value`
|
139
|
+
- Key format: `model_name:id:field_name:yyyy-mm-ddThh`
|
140
|
+
- `minutely_value`
|
141
|
+
- Key format: `model_name:id:field_name:yyyy-mm-ddThh:mi`
|
142
|
+
|
102
143
|
### Periodical Hashes
|
103
144
|
|
104
145
|
The periodical hashes also automatically switches the save destination when the date changes.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Redis
|
4
|
+
module BaseValueObject
|
5
|
+
private
|
6
|
+
|
7
|
+
def get_redis_object(key)
|
8
|
+
Redis::Value.new(key)
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_value_from_redis(key)
|
12
|
+
unmarshal(redis.get(key))
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_values_from_redis(keys)
|
16
|
+
redis.mget(*keys).map { |v| unmarshal(v) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete_from_redis(key)
|
20
|
+
redis.del(key)
|
21
|
+
end
|
22
|
+
|
23
|
+
def empty_value
|
24
|
+
[]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'redis/periodical_value'
|
4
|
+
|
5
|
+
Redis::PERIODICALS.each do |periodical| # rubocop:disable Metrics/BlockLength
|
6
|
+
new_module = Module.new
|
7
|
+
new_module.module_eval <<~RUBY, __FILE__, __LINE__ + 1
|
8
|
+
def self.included(klass)
|
9
|
+
klass.extend ClassMethods
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
def #{periodical}_value(name, options = {})
|
14
|
+
redis_objects[name.to_sym] = options.merge(:type => :value)
|
15
|
+
|
16
|
+
mod = Module.new do
|
17
|
+
define_method(name) do
|
18
|
+
Redis::#{periodical.capitalize}Value.new(
|
19
|
+
redis_field_key(name), redis_field_redis(name), redis_options(name)
|
20
|
+
)
|
21
|
+
end
|
22
|
+
define_method(:"#\{name}=") do |value|
|
23
|
+
public_send(name).value = value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if options[:global]
|
28
|
+
extend mod
|
29
|
+
|
30
|
+
# dispatch to class methods
|
31
|
+
define_method(name) do
|
32
|
+
self.class.public_send(name)
|
33
|
+
end
|
34
|
+
define_method(:"#\{name}=") do |value|
|
35
|
+
self.class.public_send(:"#\{name}=", value)
|
36
|
+
end
|
37
|
+
else
|
38
|
+
include mod
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
RUBY
|
43
|
+
Redis::Objects.const_set("#{periodical.capitalize}Values", new_module)
|
44
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "#{File.dirname(__FILE__)}/recurring_at_intervals"
|
4
|
+
require "#{File.dirname(__FILE__)}/base_value_object"
|
5
|
+
|
6
|
+
Redis::PERIODICALS.each do |periodical|
|
7
|
+
require "#{File.dirname(__FILE__)}/recurring_at_intervals/#{periodical}"
|
8
|
+
|
9
|
+
new_class = Class.new(Redis::Value) do
|
10
|
+
include Redis::RecurringAtIntervals
|
11
|
+
include Redis::BaseValueObject
|
12
|
+
include const_get("Redis::RecurringAtIntervals::#{periodical.capitalize}")
|
13
|
+
end
|
14
|
+
Redis.const_set("#{periodical.capitalize}Value", new_class)
|
15
|
+
end
|
@@ -9,6 +9,7 @@ class Redis
|
|
9
9
|
autoload :"#{periodical.capitalize}Counter", 'redis/periodical_counter'
|
10
10
|
autoload :"#{periodical.capitalize}HashKey", 'redis/periodical_hash_key'
|
11
11
|
autoload :"#{periodical.capitalize}Set", 'redis/periodical_set'
|
12
|
+
autoload :"#{periodical.capitalize}Value", 'redis/periodical_value'
|
12
13
|
end
|
13
14
|
|
14
15
|
module Objects
|
@@ -16,6 +17,7 @@ class Redis
|
|
16
17
|
autoload :"#{periodical.capitalize}Counters", 'redis/objects/periodical_counters'
|
17
18
|
autoload :"#{periodical.capitalize}Hashes", 'redis/objects/periodical_hashes'
|
18
19
|
autoload :"#{periodical.capitalize}Sets", 'redis/objects/periodical_sets'
|
20
|
+
autoload :"#{periodical.capitalize}Values", 'redis/objects/periodical_values'
|
19
21
|
end
|
20
22
|
|
21
23
|
class << self
|
@@ -29,6 +31,7 @@ class Redis
|
|
29
31
|
klass.send :include, const_get("Redis::Objects::#{periodical.capitalize}Counters")
|
30
32
|
klass.send :include, const_get("Redis::Objects::#{periodical.capitalize}Hashes")
|
31
33
|
klass.send :include, const_get("Redis::Objects::#{periodical.capitalize}Sets")
|
34
|
+
klass.send :include, const_get("Redis::Objects::#{periodical.capitalize}Values")
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|
@@ -29,8 +29,9 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.required_ruby_version = '>= 2.7.0'
|
31
31
|
|
32
|
-
spec.add_dependency 'redis-objects'
|
32
|
+
spec.add_dependency 'redis-objects', '~> 1.0'
|
33
33
|
|
34
34
|
# For more information and examples about making a new gem, checkout our
|
35
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
36
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
36
37
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
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.7.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
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '1.0'
|
27
27
|
description: Extends Redis::Objects to switch automatically the save destination within
|
28
28
|
Redis on changing dates.
|
29
29
|
email:
|
@@ -54,13 +54,16 @@ files:
|
|
54
54
|
- lib/redis/base_counter_object.rb
|
55
55
|
- lib/redis/base_hash_key_object.rb
|
56
56
|
- lib/redis/base_set_object.rb
|
57
|
+
- lib/redis/base_value_object.rb
|
57
58
|
- lib/redis/objects/periodical/version.rb
|
58
59
|
- lib/redis/objects/periodical_counters.rb
|
59
60
|
- lib/redis/objects/periodical_hashes.rb
|
60
61
|
- lib/redis/objects/periodical_sets.rb
|
62
|
+
- lib/redis/objects/periodical_values.rb
|
61
63
|
- lib/redis/periodical_counter.rb
|
62
64
|
- lib/redis/periodical_hash_key.rb
|
63
65
|
- lib/redis/periodical_set.rb
|
66
|
+
- lib/redis/periodical_value.rb
|
64
67
|
- lib/redis/recurring_at_intervals.rb
|
65
68
|
- lib/redis/recurring_at_intervals/annual.rb
|
66
69
|
- lib/redis/recurring_at_intervals/daily.rb
|
@@ -76,6 +79,7 @@ metadata:
|
|
76
79
|
homepage_uri: https://github.com/ryz310/redis-objects-periodical
|
77
80
|
source_code_uri: https://github.com/ryz310/redis-objects-periodical
|
78
81
|
changelog_uri: https://github.com/ryz310/redis-objects-periodical/blob/master/CHANGELOG.md
|
82
|
+
rubygems_mfa_required: 'true'
|
79
83
|
post_install_message:
|
80
84
|
rdoc_options: []
|
81
85
|
require_paths:
|
@@ -91,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
95
|
- !ruby/object:Gem::Version
|
92
96
|
version: '0'
|
93
97
|
requirements: []
|
94
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.4.6
|
95
99
|
signing_key:
|
96
100
|
specification_version: 4
|
97
101
|
summary: Extends Redis::Objects as periodical.
|