checkoff 0.135.0 → 0.136.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/checkoff/timing.rb +24 -6
- data/lib/checkoff/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e9b8a139f08b5a53da99f785ac0e57bed14e919e43cc56ecf929c3558e4b567
|
4
|
+
data.tar.gz: 524fd6f5a31e9737403610de5b5e6ae42671e8f157702feeeec79f1154b99c1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df7a2327a7a1e63e15342dadcc6fded785de79c867bc4d9cf0de9b3d0c3c57d639c0908002162a188cd0fa261108b91a33788fd29f159f99f2f4139774f1a636
|
7
|
+
data.tar.gz: 55ffabad75909f3475ef78d702d6606be979dbce8ecbb3521133ec225651cdb53481ae4e5ddc571b587dbf88b63a1a7e78b3a7b271b43fa49169c15d80b26bad
|
data/Gemfile.lock
CHANGED
data/lib/checkoff/timing.rb
CHANGED
@@ -9,6 +9,7 @@ require 'active_support'
|
|
9
9
|
require 'forwardable'
|
10
10
|
require 'cache_method'
|
11
11
|
require_relative 'internal/config_loader'
|
12
|
+
require_relative 'internal/logging'
|
12
13
|
require_relative 'workspaces'
|
13
14
|
require_relative 'clients'
|
14
15
|
|
@@ -22,6 +23,8 @@ module Checkoff
|
|
22
23
|
LONG_CACHE_TIME = MINUTE * 15
|
23
24
|
SHORT_CACHE_TIME = MINUTE
|
24
25
|
|
26
|
+
include Logging
|
27
|
+
|
25
28
|
# @param today_getter [Class<Date>]
|
26
29
|
# @param now_getter [Class<Time>]
|
27
30
|
def initialize(today_getter: Date,
|
@@ -128,20 +131,35 @@ module Checkoff
|
|
128
131
|
(@now_getter.now + (num_days * 24 * 60 * 60))
|
129
132
|
end
|
130
133
|
|
134
|
+
# @param num_days [Integer]
|
135
|
+
#
|
136
|
+
# @return [Date]
|
137
|
+
def n_days_from_today(num_days)
|
138
|
+
(@today_getter.today + num_days)
|
139
|
+
end
|
140
|
+
|
131
141
|
# @param date_or_time [Date,Time,nil]
|
132
142
|
# @param beginning_num_days_from_now [Integer,nil]
|
133
143
|
# @param end_num_days_from_now [Integer,nil]
|
134
144
|
def between_relative_days?(date_or_time, beginning_num_days_from_now, end_num_days_from_now)
|
135
|
-
|
136
|
-
|
145
|
+
start_date = n_days_from_today(beginning_num_days_from_now || -99_999)
|
146
|
+
end_date = n_days_from_today(end_num_days_from_now || 99_999)
|
137
147
|
|
138
148
|
return false if date_or_time.nil?
|
139
149
|
|
140
|
-
if date_or_time.is_a?(Time)
|
141
|
-
|
142
|
-
|
143
|
-
|
150
|
+
date = if date_or_time.is_a?(Time)
|
151
|
+
date_or_time.localtime.to_date
|
152
|
+
else
|
153
|
+
date_or_time
|
154
|
+
end
|
155
|
+
out = date > start_date && date <= end_date
|
156
|
+
logger.debug do
|
157
|
+
"Checkoff::Timing#between_relative_days?(#{date_or_time.inspect} " \
|
158
|
+
"(as date: #{date.inspect}) " \
|
159
|
+
"#{beginning_num_days_from_now.inspect}, #{end_num_days_from_now.inspect}) " \
|
160
|
+
"comparing with #{start_date} and #{end_date} = #{out.inspect}"
|
144
161
|
end
|
162
|
+
out
|
145
163
|
end
|
146
164
|
|
147
165
|
# @param date_or_time [Date,Time,nil]
|
data/lib/checkoff/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checkoff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.136.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vince Broz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|