checkoff 0.151.0 → 0.152.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 814abd2292e805c48daa1ab1fbfafd5f48930f0690a40f0ec4f09ccf4236b2ab
4
- data.tar.gz: fc4237862cf34cc1541bf025a982115d10d727733f4146d6dcfe2ad6d6222302
3
+ metadata.gz: 84672143c6f2b9e08cd8be54cd4cf20d0bce2f56e72e9f2c98a7db3b48b690a3
4
+ data.tar.gz: 9e4cb2b6e73615e510cc169797d17f3d5552f5abb89be6a329b370219c79f647
5
5
  SHA512:
6
- metadata.gz: bcbe6b9ec7e0b8c74bbb80a3493b8a223c4d9f4e6151068eb9fefaf5bf6f6db9babc158b69c59fff799f80f5841f59317ad5043daa8b12fa3c248a89f80b6b0c
7
- data.tar.gz: e5af723e0c0877b78e4a546bbe511f2132439be39c3923033c59a4cfb640c5bd3616e735518db90e2fb0d3234bb6d971b9ba1e7374ffdd6aae5eccbad8b22064
6
+ metadata.gz: f2b491d76c73456868a98511e2653842480cad9505fa844bdccfc75e71263305c1c68d7b5a178762fbfb25fedd55861249670e0ac273ccd1605cb47f6db78b36
7
+ data.tar.gz: e7acaa05c794fcf15e346eb95fb881fafa1f295e685687ec0425bc00561dc5c5d8d0eb9ebfad2c957af01d6ed387171c83f9f4c508e180d1e46ac2609e2ce2cc
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.151.0)
15
+ checkoff (0.152.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -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?
@@ -3,5 +3,5 @@
3
3
  # Command-line and gem client for Asana (unofficial)
4
4
  module Checkoff
5
5
  # Version of library
6
- VERSION = '0.151.0'
6
+ VERSION = '0.152.0'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.151.0
4
+ version: 0.152.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz