periodoxical 1.2.0 → 2.2.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 -3
- data/README.md +1 -36
- data/lib/periodoxical/version.rb +1 -1
- data/lib/periodoxical.rb +0 -8
- data/periodoxical.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ace9209a6c531a382b264e87513dc6e5075499fc90f1eba313404368d96e58ba
|
4
|
+
data.tar.gz: e1771a96128f204df520f39bfcb54d3a294c130da07d0c9f971b98908fe985ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaaf84f0c0af53ad1df2f595298a8327fc67574b7a35c08a27a921f0719ef6eea0990a7ee28423755f3baa0abe78d31e4bad7bcd42f82d1c9ebe6607b0fe0574
|
7
|
+
data.tar.gz: 8eed0bfd9236bb43084c0427a50ac6ce6b793411d30adffd1d12b303ae57d0cf8d5dc0281b1c654aa15584a436066dea7f1a39a5283bdc7ef398df9dde56ec5c
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
periodoxical (
|
4
|
+
periodoxical (2.2.0)
|
5
5
|
tzinfo (~> 2.0, >= 2.0.0)
|
6
|
-
week_of_month (= 1.2.6)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -41,7 +40,6 @@ GEM
|
|
41
40
|
rspec-support (3.13.1)
|
42
41
|
tzinfo (2.0.6)
|
43
42
|
concurrent-ruby (~> 1.0)
|
44
|
-
week_of_month (1.2.6)
|
45
43
|
|
46
44
|
PLATFORMS
|
47
45
|
arm64-darwin-22
|
data/README.md
CHANGED
@@ -209,7 +209,7 @@ Periodoxical.generate(
|
|
209
209
|
)
|
210
210
|
```
|
211
211
|
|
212
|
-
### Specifying time blocks using rules for
|
212
|
+
### Specifying time blocks using rules for month(s) and/or day-of-month.
|
213
213
|
|
214
214
|
As a Ruby dev, I want to generate the next 3 timeblocks for **8AM - 9AM** for the **5th** and **10th** day of every month starting from **June**. I can do this using the `days_of_month` parameter.
|
215
215
|
|
@@ -240,41 +240,6 @@ Periodoxical.generate(
|
|
240
240
|
]
|
241
241
|
```
|
242
242
|
|
243
|
-
As a Ruby dev, I want to generate **4** timeblocks for **8AM - 9AM** on **Mondays** but only in the **first two weeks** in the months of **April, May, and June**. I can do this using the `months` parameter.
|
244
|
-
|
245
|
-
```
|
246
|
-
Periodoxical.generate(
|
247
|
-
time_zone: 'America/Los_Angeles',
|
248
|
-
starting_from: '2024-04-01',
|
249
|
-
limit: 4,
|
250
|
-
weeks_of_month: [1 2],
|
251
|
-
months: [4, 5, 6],
|
252
|
-
days_of_week: %w(mon),
|
253
|
-
time_blocks: [
|
254
|
-
{ start_time: '8:00AM', end_time: '9:00AM' },
|
255
|
-
],
|
256
|
-
)
|
257
|
-
#=>
|
258
|
-
[
|
259
|
-
{
|
260
|
-
start_time: #<DateTime: 2024-04-01T08:00:00-0700>,
|
261
|
-
end_time: #<DateTime: 2024-04-01T09:00:00-0700>,
|
262
|
-
},
|
263
|
-
{
|
264
|
-
start_time: #<DateTime: 2024-04-08T08:00:00-0700>,
|
265
|
-
end_time: #<DateTime: 2024-04-08T09:00:00-0700>,
|
266
|
-
},
|
267
|
-
{
|
268
|
-
start_time: #<DateTime: 2024-05-06T08:00:00-0700>,
|
269
|
-
end_time: #<DateTime: 2024-05-06T09:00:00-0700>,
|
270
|
-
},
|
271
|
-
{
|
272
|
-
start_time: #<DateTime: 2024-06-03T08:00:00-0700>,
|
273
|
-
end_time: #<DateTime: 2024-06-03T09:00:00-0700>,
|
274
|
-
},
|
275
|
-
]
|
276
|
-
```
|
277
|
-
|
278
243
|
### Example 6 - Specify nth day-of-week in month (ie. first Monday of the Month, second Tuesday of the Month, last Friday of Month)
|
279
244
|
As a Ruby dev, I want to generate timeblocks for **8AM - 9AM** on the **first and second Mondays** and **last Fridays** of every month starting in June 2024. I can do this with the `nth_day_of_week_in_month` param.
|
280
245
|
|
data/lib/periodoxical/version.rb
CHANGED
data/lib/periodoxical.rb
CHANGED
@@ -4,7 +4,6 @@ require "periodoxical/helpers"
|
|
4
4
|
require "date"
|
5
5
|
require "time"
|
6
6
|
require "tzinfo"
|
7
|
-
require "week_of_month"
|
8
7
|
|
9
8
|
module Periodoxical
|
10
9
|
class << self
|
@@ -84,7 +83,6 @@ module Periodoxical
|
|
84
83
|
days_of_week: nil,
|
85
84
|
nth_day_of_week_in_month: nil,
|
86
85
|
days_of_month: nil,
|
87
|
-
weeks_of_month: nil,
|
88
86
|
duration: nil,
|
89
87
|
months: nil
|
90
88
|
)
|
@@ -97,7 +95,6 @@ module Periodoxical
|
|
97
95
|
end
|
98
96
|
@nth_day_of_week_in_month = deep_symbolize_keys(nth_day_of_week_in_month)
|
99
97
|
@days_of_month = days_of_month
|
100
|
-
@weeks_of_month = weeks_of_month
|
101
98
|
@months = months
|
102
99
|
@time_blocks = deep_symbolize_keys(time_blocks)
|
103
100
|
@day_of_week_time_blocks = deep_symbolize_keys(day_of_week_time_blocks)
|
@@ -267,11 +264,6 @@ module Periodoxical
|
|
267
264
|
return false if @exclusion_dates.include?(@current_date)
|
268
265
|
end
|
269
266
|
|
270
|
-
# If weeks_of_months are specified but not satisified, return false
|
271
|
-
if @weeks_of_month
|
272
|
-
return false unless @weeks_of_month.include?(@current_date.week_of_month)
|
273
|
-
end
|
274
|
-
|
275
267
|
# If months are specified, but current_date does not satisfy months,
|
276
268
|
# return false
|
277
269
|
if @months
|
data/periodoxical.gemspec
CHANGED
@@ -35,7 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.require_paths = ["lib"]
|
36
36
|
|
37
37
|
spec.add_dependency 'tzinfo', '~> 2.0', '>= 2.0.0'
|
38
|
-
spec.add_dependency 'week_of_month', '1.2.6'
|
39
38
|
|
40
39
|
spec.add_development_dependency "bundler", "~> 2.4"
|
41
40
|
spec.add_development_dependency "rake", "~> 12.3.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: periodoxical
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Li
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -30,20 +30,6 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.0.0
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: week_of_month
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - '='
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 1.2.6
|
40
|
-
type: :runtime
|
41
|
-
prerelease: false
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - '='
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 1.2.6
|
47
33
|
- !ruby/object:Gem::Dependency
|
48
34
|
name: bundler
|
49
35
|
requirement: !ruby/object:Gem::Requirement
|