rrule 0.6.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/.github/workflows/test.yml +9 -13
- data/.gitignore +1 -0
- data/Appraisals +8 -18
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -6
- data/gemfiles/activesupport_7_0.gemfile +3 -6
- data/gemfiles/activesupport_7_1.gemfile +3 -6
- data/gemfiles/{activesupport_6_1.gemfile → activesupport_7_2.gemfile} +4 -7
- data/gemfiles/activesupport_8_0.gemfile +12 -0
- data/lib/rrule/frequencies/frequency.rb +6 -0
- data/lib/rrule/frequencies/hourly.rb +19 -0
- data/lib/rrule/frequencies/minutely.rb +19 -0
- data/lib/rrule/frequencies/secondly.rb +19 -0
- data/lib/rrule/humanizer.rb +36 -1
- data/lib/rrule/rule.rb +5 -5
- data/lib/rrule/version.rb +1 -1
- data/lib/rrule.rb +8 -1
- data/rrule.gemspec +0 -1
- metadata +8 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18b66d2de18ada244aeacb726282250b2d9790852df19256fbc60427d719e5ec
|
4
|
+
data.tar.gz: a89994f6528f083862167f71af7fefca19ecd556376d8d0072dc61644b1d7950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54e5ab9633d824c81c72e1fdafada840c77fa3154f7e56e8d553784bc000aac67937bd3860aa28bcdd4f62b19d5192c7fc5783abc02aff3bd0d72bca4bb7be8c
|
7
|
+
data.tar.gz: 2603169ed547adea95c88b0377afd6e9707d7845759aceb153c284b81c2b0971dfc4d73c47bcd0634db80c1fb08d3728b4805408ddacb1be3d935dae55657873
|
data/.github/workflows/test.yml
CHANGED
@@ -10,18 +10,11 @@ jobs:
|
|
10
10
|
strategy:
|
11
11
|
matrix:
|
12
12
|
ruby:
|
13
|
-
- 3.
|
14
|
-
- 3.
|
15
|
-
- 3.
|
16
|
-
- 3.3.0
|
17
|
-
gemfile:
|
18
|
-
- gemfiles/activesupport_6_1.gemfile
|
19
|
-
- gemfiles/activesupport_7_0.gemfile
|
20
|
-
- gemfiles/activesupport_7_1.gemfile
|
13
|
+
- 3.2
|
14
|
+
- 3.3
|
15
|
+
- 3.4
|
21
16
|
|
22
|
-
name: Ruby ${{ matrix.ruby }}
|
23
|
-
env:
|
24
|
-
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
17
|
+
name: Ruby ${{ matrix.ruby }}
|
25
18
|
steps:
|
26
19
|
- uses: actions/checkout@v3
|
27
20
|
- uses: ruby/setup-ruby@v1
|
@@ -31,11 +24,14 @@ jobs:
|
|
31
24
|
run: yes | gem update --system --force
|
32
25
|
- name: 'Update Bundler'
|
33
26
|
run: gem install bundler
|
34
|
-
- uses: actions/cache@
|
27
|
+
- uses: actions/cache@v4
|
35
28
|
with:
|
36
29
|
path: vendor/bundle
|
37
30
|
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
38
31
|
restore-keys: |
|
39
32
|
${{ runner.os }}-gems-
|
40
33
|
- run: bundle install
|
41
|
-
-
|
34
|
+
- name: 'Ensure appraisals are up to date'
|
35
|
+
run: appraisal clean && appraisal generate && git diff --exit-code
|
36
|
+
- run: appraisal install
|
37
|
+
- run: appraisal rake
|
data/.gitignore
CHANGED
data/Appraisals
CHANGED
@@ -1,27 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
appraise 'activesupport-
|
4
|
-
gem '
|
5
|
-
gem 'activesupport', '>= 2', git: 'https://github.com/makandra/rails.git', branch: '2-3-lts'
|
3
|
+
appraise 'activesupport-7_0' do
|
4
|
+
gem 'activesupport', '~> 7.0'
|
6
5
|
end
|
7
6
|
|
8
|
-
appraise 'activesupport-
|
9
|
-
gem 'activesupport', '~>
|
10
|
-
gem 'tzinfo', '~> 1.2'
|
7
|
+
appraise 'activesupport-7_1' do
|
8
|
+
gem 'activesupport', '~> 7.1'
|
11
9
|
end
|
12
10
|
|
13
|
-
appraise 'activesupport-
|
14
|
-
gem 'activesupport', '~>
|
11
|
+
appraise 'activesupport-7_2' do
|
12
|
+
gem 'activesupport', '~> 7.2'
|
15
13
|
end
|
16
14
|
|
17
|
-
appraise 'activesupport-
|
18
|
-
gem 'activesupport', '~>
|
19
|
-
end
|
20
|
-
|
21
|
-
appraise 'activesupport-6' do
|
22
|
-
gem 'activesupport', '~> 6'
|
23
|
-
end
|
24
|
-
|
25
|
-
appraise 'activesupport-7' do
|
26
|
-
gem 'activesupport', '~> 7'
|
15
|
+
appraise 'activesupport-8_0' do
|
16
|
+
gem 'activesupport', '~> 8.0'
|
27
17
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
Change Log
|
2
2
|
==========
|
3
3
|
|
4
|
+
Version 0.7.0 *(2025-10-20)*
|
5
|
+
----------------------------
|
6
|
+
## What's Changed
|
7
|
+
* Add support for `YEARLY` `BYMONTHDAY` https://github.com/square/ruby-rrule/pull/69
|
8
|
+
|
4
9
|
Version 0.6.0 *(2024-03-07)*
|
5
10
|
----------------------------
|
6
11
|
## What's Changed
|
data/Gemfile
CHANGED
@@ -2,13 +2,10 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
gem '
|
5
|
+
gem 'appraisal'
|
6
|
+
gem 'pry-byebug'
|
6
7
|
gem 'rake'
|
7
|
-
gem 'rspec'
|
8
|
+
gem 'rspec'
|
8
9
|
gem 'rubocop', '0.63.1'
|
9
10
|
|
10
|
-
platform :mri do
|
11
|
-
gem 'pry-byebug', '~> 3.10.1'
|
12
|
-
end
|
13
|
-
|
14
11
|
gemspec
|
@@ -2,14 +2,11 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "
|
5
|
+
gem "appraisal"
|
6
|
+
gem "pry-byebug"
|
6
7
|
gem "rake"
|
7
|
-
gem "rspec"
|
8
|
+
gem "rspec"
|
8
9
|
gem "rubocop", "0.63.1"
|
9
10
|
gem "activesupport", "~> 7.0"
|
10
11
|
|
11
|
-
platforms :mri do
|
12
|
-
gem "pry-byebug"
|
13
|
-
end
|
14
|
-
|
15
12
|
gemspec path: "../"
|
@@ -2,14 +2,11 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "
|
5
|
+
gem "appraisal"
|
6
|
+
gem "pry-byebug"
|
6
7
|
gem "rake"
|
7
|
-
gem "rspec"
|
8
|
+
gem "rspec"
|
8
9
|
gem "rubocop", "0.63.1"
|
9
10
|
gem "activesupport", "~> 7.1"
|
10
11
|
|
11
|
-
platforms :mri do
|
12
|
-
gem "pry-byebug"
|
13
|
-
end
|
14
|
-
|
15
12
|
gemspec path: "../"
|
@@ -2,14 +2,11 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "
|
5
|
+
gem "appraisal"
|
6
|
+
gem "pry-byebug"
|
6
7
|
gem "rake"
|
7
|
-
gem "rspec"
|
8
|
+
gem "rspec"
|
8
9
|
gem "rubocop", "0.63.1"
|
9
|
-
gem "activesupport", "~>
|
10
|
-
|
11
|
-
platforms :mri do
|
12
|
-
gem "pry-byebug"
|
13
|
-
end
|
10
|
+
gem "activesupport", "~> 7.2"
|
14
11
|
|
15
12
|
gemspec path: "../"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RRule
|
4
|
+
class Hourly < Frequency
|
5
|
+
def possible_days
|
6
|
+
[current_date.yday - 1] # convert to 0-indexed
|
7
|
+
end
|
8
|
+
|
9
|
+
def timeset
|
10
|
+
super.map { |time| time.merge(hour: current_date.hour) }
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def advance_by
|
16
|
+
{ hours: context.options[:interval] }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RRule
|
4
|
+
class Minutely < Frequency
|
5
|
+
def possible_days
|
6
|
+
[current_date.yday - 1] # convert to 0-indexed
|
7
|
+
end
|
8
|
+
|
9
|
+
def timeset
|
10
|
+
super.map { |time| time.merge(hour: current_date.hour, minute: current_date.min) }
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def advance_by
|
16
|
+
{ minutes: context.options[:interval] }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RRule
|
4
|
+
class Secondly < Frequency
|
5
|
+
def possible_days
|
6
|
+
[current_date.yday - 1] # convert to 0-indexed
|
7
|
+
end
|
8
|
+
|
9
|
+
def timeset
|
10
|
+
super.map { |time| time.merge(hour: current_date.hour, minute: current_date.min, second: current_date.sec) }
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def advance_by
|
16
|
+
{ seconds: context.options[:interval] }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/rrule/humanizer.rb
CHANGED
@@ -18,6 +18,21 @@ module RRule
|
|
18
18
|
Saturday
|
19
19
|
].freeze
|
20
20
|
|
21
|
+
MONTH_NAMES = %w[
|
22
|
+
January
|
23
|
+
February
|
24
|
+
March
|
25
|
+
April
|
26
|
+
May
|
27
|
+
June
|
28
|
+
July
|
29
|
+
August
|
30
|
+
September
|
31
|
+
October
|
32
|
+
November
|
33
|
+
December
|
34
|
+
].freeze
|
35
|
+
|
21
36
|
def initialize(rrule, options)
|
22
37
|
@rrule = rrule
|
23
38
|
@options = options
|
@@ -97,6 +112,17 @@ module RRule
|
|
97
112
|
end
|
98
113
|
end
|
99
114
|
|
115
|
+
def yearly
|
116
|
+
add interval_option if interval_option != 1
|
117
|
+
add plural?(interval_option) ? 'years' : 'year'
|
118
|
+
|
119
|
+
add 'on' if bymonthday_option || bymonth_option
|
120
|
+
|
121
|
+
add list(options.fetch(:bymonth), method(:monthtext), 'and') if bymonth_option
|
122
|
+
|
123
|
+
add list (bymonthday_option.map { |o| nth(o) }), :to_s, 'and' if bymonthday_option
|
124
|
+
end
|
125
|
+
|
100
126
|
def weekly
|
101
127
|
if interval_option != 1
|
102
128
|
add interval_option
|
@@ -157,6 +183,10 @@ module RRule
|
|
157
183
|
[day.ordinal && nth(day.ordinal), DAY_NAMES[day.index]].compact.join(' ')
|
158
184
|
end
|
159
185
|
|
186
|
+
def monthtext(month)
|
187
|
+
MONTH_NAMES[month - 1]
|
188
|
+
end
|
189
|
+
|
160
190
|
def all_weeks?
|
161
191
|
bynweekday_option.all? { |option| option.ordinal.nil? }
|
162
192
|
end
|
@@ -172,7 +202,7 @@ module RRule
|
|
172
202
|
end
|
173
203
|
|
174
204
|
def _bymonth
|
175
|
-
add list(
|
205
|
+
add list(options.fetch(:bymonth), method(:monthtext), 'and')
|
176
206
|
end
|
177
207
|
|
178
208
|
def _byweekday
|
@@ -188,6 +218,11 @@ module RRule
|
|
188
218
|
add list(bynweekday_option, method(:weekdaytext), 'and')
|
189
219
|
end
|
190
220
|
|
221
|
+
def _bymonthday
|
222
|
+
add 'on the'
|
223
|
+
add list (bymonthday_option.map { |o| nth(o) }), :to_s, 'and'
|
224
|
+
end
|
225
|
+
|
191
226
|
def _byhour
|
192
227
|
add 'at'
|
193
228
|
add list byhour_option, :to_s, 'and'
|
data/lib/rrule/rule.rb
CHANGED
@@ -168,13 +168,13 @@ module RRule
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
unless options[:byweekno] || options[:byyearday] || options[:
|
171
|
+
unless options[:byweekno] || options[:byyearday] || options[:byweekday]
|
172
172
|
case options[:freq]
|
173
173
|
when 'YEARLY'
|
174
|
-
options[:bymonth] = [dtstart.month] unless options[:bymonth]
|
175
|
-
options[:bymonthday] = [dtstart.day]
|
174
|
+
options[:bymonth] = [dtstart.month] unless options[:bymonth] || (options[:bymonthday] && options[:count])
|
175
|
+
options[:bymonthday] = [dtstart.day] unless options[:bymonthday]
|
176
176
|
when 'MONTHLY'
|
177
|
-
options[:bymonthday] = [dtstart.day]
|
177
|
+
options[:bymonthday] = [dtstart.day] unless options[:bymonthday]
|
178
178
|
when 'WEEKLY'
|
179
179
|
options[:simple_weekly] = true
|
180
180
|
options[:byweekday] = [Weekday.new(dtstart.wday)]
|
@@ -187,7 +187,7 @@ module RRule
|
|
187
187
|
# when the associated "DTSTART" property has a DATE value type.
|
188
188
|
# These rule parts MUST be ignored in RECUR value that violate the
|
189
189
|
# above requirement
|
190
|
-
options[:timeset] = [{ hour:
|
190
|
+
options[:timeset] = [{ hour: options[:byhour].presence || dtstart.hour, minute: options[:byminute].presence || dtstart.min, second: options[:bysecond].presence || dtstart.sec }] unless dtstart.is_a?(Date)
|
191
191
|
|
192
192
|
options
|
193
193
|
end
|
data/lib/rrule/version.rb
CHANGED
data/lib/rrule.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'active_support
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/core_ext/time'
|
5
|
+
require 'active_support/core_ext/object/blank'
|
6
|
+
require 'active_support/core_ext/integer/time'
|
7
|
+
require 'active_support/core_ext/array/wrap'
|
4
8
|
|
5
9
|
module RRule
|
6
10
|
autoload :Rule, 'rrule/rule'
|
@@ -9,6 +13,9 @@ module RRule
|
|
9
13
|
autoload :Humanizer, 'rrule/humanizer'
|
10
14
|
|
11
15
|
autoload :Frequency, 'rrule/frequencies/frequency'
|
16
|
+
autoload :Secondly, 'rrule/frequencies/secondly'
|
17
|
+
autoload :Minutely, 'rrule/frequencies/minutely'
|
18
|
+
autoload :Hourly, 'rrule/frequencies/hourly'
|
12
19
|
autoload :Daily, 'rrule/frequencies/daily'
|
13
20
|
autoload :Weekly, 'rrule/frequencies/weekly'
|
14
21
|
autoload :SimpleWeekly, 'rrule/frequencies/simple_weekly'
|
data/rrule.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rrule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Mitchell
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activesupport
|
@@ -24,20 +23,6 @@ dependencies:
|
|
24
23
|
- - ">="
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '2.3'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: appraisal
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
26
|
description: A gem for expanding dates according to the RRule specification
|
42
27
|
email: rmitchell@squareup.com
|
43
28
|
executables: []
|
@@ -54,9 +39,10 @@ files:
|
|
54
39
|
- LICENSE.txt
|
55
40
|
- README.md
|
56
41
|
- Rakefile
|
57
|
-
- gemfiles/activesupport_6_1.gemfile
|
58
42
|
- gemfiles/activesupport_7_0.gemfile
|
59
43
|
- gemfiles/activesupport_7_1.gemfile
|
44
|
+
- gemfiles/activesupport_7_2.gemfile
|
45
|
+
- gemfiles/activesupport_8_0.gemfile
|
60
46
|
- lib/rrule.rb
|
61
47
|
- lib/rrule/context.rb
|
62
48
|
- lib/rrule/filters/by_month.rb
|
@@ -66,7 +52,10 @@ files:
|
|
66
52
|
- lib/rrule/filters/by_year_day.rb
|
67
53
|
- lib/rrule/frequencies/daily.rb
|
68
54
|
- lib/rrule/frequencies/frequency.rb
|
55
|
+
- lib/rrule/frequencies/hourly.rb
|
56
|
+
- lib/rrule/frequencies/minutely.rb
|
69
57
|
- lib/rrule/frequencies/monthly.rb
|
58
|
+
- lib/rrule/frequencies/secondly.rb
|
70
59
|
- lib/rrule/frequencies/simple_weekly.rb
|
71
60
|
- lib/rrule/frequencies/weekly.rb
|
72
61
|
- lib/rrule/frequencies/yearly.rb
|
@@ -87,7 +76,6 @@ metadata:
|
|
87
76
|
source_code_uri: https://github.com/square/ruby-rrule
|
88
77
|
bug_tracker_uri: https://github.com/square/ruby-rrule/issues
|
89
78
|
changelog_uri: https://github.com/square/ruby-rrule/blob/master/CHANGELOG.md
|
90
|
-
post_install_message:
|
91
79
|
rdoc_options: []
|
92
80
|
require_paths:
|
93
81
|
- lib
|
@@ -102,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
90
|
- !ruby/object:Gem::Version
|
103
91
|
version: '0'
|
104
92
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
106
|
-
signing_key:
|
93
|
+
rubygems_version: 3.6.9
|
107
94
|
specification_version: 4
|
108
95
|
summary: RRule expansion
|
109
96
|
test_files: []
|