checkoff 0.151.0 → 0.153.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +8 -8
- data/lib/checkoff/timing.rb +25 -0
- data/lib/checkoff/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7e51a414e4d6bf0451ff81ace5951718f32a115ac61b1d5fc3930b3f82d3fd4
|
4
|
+
data.tar.gz: 6b89e1f7a6cf317309ebed700279a375c568afee782c5ae8cf4e18bd7dc2b3f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bfd9fe45ba1b913d636edf8c5f0d403f3e63a553e28f98230328b50acf62002452221ec368106bbe70a3daff97c3c215e3566e7d864235ad64ab88d5a04793e
|
7
|
+
data.tar.gz: 94f52681e4fe654b96d899351b9248918bbf4b39643a0c74d4210e5dd4d90564300afa179e9eabd3ea1d3d682240c1f8adff94610754efa63e2c6054d8e1c698
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -12,7 +12,7 @@ GIT
|
|
12
12
|
PATH
|
13
13
|
remote: .
|
14
14
|
specs:
|
15
|
-
checkoff (0.
|
15
|
+
checkoff (0.153.0)
|
16
16
|
activesupport
|
17
17
|
asana (> 0.10.0)
|
18
18
|
cache_method
|
@@ -96,7 +96,7 @@ GEM
|
|
96
96
|
parser (>= 2.5, != 2.5.1.1)
|
97
97
|
iniparse (1.5.0)
|
98
98
|
jaro_winkler (1.5.6)
|
99
|
-
json (2.
|
99
|
+
json (2.7.1)
|
100
100
|
jwt (2.7.1)
|
101
101
|
kramdown (2.4.0)
|
102
102
|
rexml
|
@@ -159,11 +159,11 @@ GEM
|
|
159
159
|
rainbow (3.1.1)
|
160
160
|
rake (13.1.0)
|
161
161
|
rbs (2.8.4)
|
162
|
-
regexp_parser (2.8.
|
162
|
+
regexp_parser (2.8.3)
|
163
163
|
reverse_markdown (2.1.1)
|
164
164
|
nokogiri
|
165
165
|
rexml (3.2.6)
|
166
|
-
rubocop (1.
|
166
|
+
rubocop (1.58.0)
|
167
167
|
json (~> 2.3)
|
168
168
|
language_server-protocol (>= 3.17.0)
|
169
169
|
parallel (~> 1.10)
|
@@ -171,7 +171,7 @@ GEM
|
|
171
171
|
rainbow (>= 2.2.2, < 4.0)
|
172
172
|
regexp_parser (>= 1.8, < 3.0)
|
173
173
|
rexml (>= 3.2.5, < 4.0)
|
174
|
-
rubocop-ast (>= 1.
|
174
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
175
175
|
ruby-progressbar (~> 1.7)
|
176
176
|
unicode-display_width (>= 2.4.0, < 3.0)
|
177
177
|
rubocop-ast (1.30.0)
|
@@ -190,7 +190,7 @@ GEM
|
|
190
190
|
simplecov-html (0.12.3)
|
191
191
|
simplecov-lcov (0.8.0)
|
192
192
|
simplecov_json_formatter (0.1.4)
|
193
|
-
solargraph (0.
|
193
|
+
solargraph (0.50.0)
|
194
194
|
backport (~> 1.2)
|
195
195
|
benchmark
|
196
196
|
bundler (~> 2.0)
|
@@ -249,10 +249,10 @@ DEPENDENCIES
|
|
249
249
|
rubocop-rake
|
250
250
|
simplecov (>= 0.18.0)
|
251
251
|
simplecov-lcov
|
252
|
-
solargraph (>= 0.
|
252
|
+
solargraph (>= 0.50.0)
|
253
253
|
undercover
|
254
254
|
webmock
|
255
255
|
yard
|
256
256
|
|
257
257
|
BUNDLED WITH
|
258
|
-
2.
|
258
|
+
2.4.22
|
data/lib/checkoff/timing.rb
CHANGED
@@ -40,6 +40,9 @@ module Checkoff
|
|
40
40
|
def in_period?(date_or_time, period)
|
41
41
|
return this_week?(date_or_time) if period == :this_week
|
42
42
|
|
43
|
+
return day_of_week?(date_or_time, period) if %i[monday tuesday wednesday thursday friday saturday
|
44
|
+
sunday].include?(period)
|
45
|
+
|
43
46
|
return true if period == :indefinite
|
44
47
|
|
45
48
|
return now_or_before?(date_or_time) if period == :now_or_before
|
@@ -117,6 +120,28 @@ module Checkoff
|
|
117
120
|
date >= beginning_of_week && date <= end_of_week
|
118
121
|
end
|
119
122
|
|
123
|
+
# @type [Hash<Symbol,Integer>]
|
124
|
+
WDAY_FROM_DAY_OF_WEEK = {
|
125
|
+
monday: 1,
|
126
|
+
tuesday: 2,
|
127
|
+
wednesday: 3,
|
128
|
+
thursday: 4,
|
129
|
+
friday: 5,
|
130
|
+
saturday: 6,
|
131
|
+
sunday: 0,
|
132
|
+
}.freeze
|
133
|
+
|
134
|
+
# @param date_or_time [Date,Time,nil]
|
135
|
+
# @param day_of_week [Symbol]
|
136
|
+
def day_of_week?(date_or_time, day_of_week)
|
137
|
+
return false if date_or_time.nil?
|
138
|
+
|
139
|
+
wday = WDAY_FROM_DAY_OF_WEEK.fetch(day_of_week)
|
140
|
+
today = @today_getter.today
|
141
|
+
date = date_or_time.to_date
|
142
|
+
date_or_time.wday == wday && date >= today && date < today + 7
|
143
|
+
end
|
144
|
+
|
120
145
|
# @param date_or_time [Date,Time,nil]
|
121
146
|
def now_or_before?(date_or_time)
|
122
147
|
return true if date_or_time.nil?
|
data/lib/checkoff/version.rb
CHANGED