rrule 0.4.4 → 0.5.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: '007499934626da51ca670d58c30fab5efe4f88c782979eaff317f440e8f237fc'
4
- data.tar.gz: a99135de58a44d1c71a2af4fee8721475f09c44cfd40ab21410c7cb755835784
3
+ metadata.gz: 102a445f4ce73b7678d2ba5ce981dd97265cd96eaba985a1a88fc65bef7dd6f5
4
+ data.tar.gz: 436d7cf84a7e8673e3909a6b0dc6b629c348ca1b0a2df83b133201e7e46413b0
5
5
  SHA512:
6
- metadata.gz: b2f9bc5d989d05bebf09aafac0ded5fd2148901481b15fce0b4ea60680cb26fefe4f6bfebe286473a02f25543e8be499b842020988da87226d6da3eaf847070f
7
- data.tar.gz: 5b450cdde1f0b8c7a6c05a0520ecfdcb43e93647e2155a0fc2dc1578f7fdf4457c42a638fe31fadfd8bd31a1fc006169dab6847a03fa2552c530283c91f78870
6
+ metadata.gz: 6b59c32ff4f679d3f7d1e8944b87e460d1a2ea5aa0bd7c38d3039cd62fb60af56dbc41e23eef63b42add7c3136e4af4ab62ef166e1c1cb643cff89e9a4784d9c
7
+ data.tar.gz: 8040ef1e6d6c127e33352032e0bb146a46a1ba22c01237fac1a14343bac6f751803cd2582ec7058dd1d32cf0e319aa8e439be5f312ff189a755b28c48efaa985
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ rvm:
4
4
  - 2.6.5
5
5
  - 2.7.0
6
6
  - 3.0.0
7
+ - 3.1.0
7
8
 
8
9
  gemfile:
9
10
  - gemfiles/activesupport_2.3_LTS.gemfile
@@ -15,6 +16,8 @@ gemfile:
15
16
 
16
17
  jobs:
17
18
  exclude:
19
+ - rvm: 2.6.5
20
+ gemfile: gemfiles/activesupport_7.gemfile
18
21
  - rvm: 2.7.0
19
22
  gemfile: gemfiles/activesupport_3.gemfile
20
23
  - rvm: 2.7.0
@@ -23,6 +26,10 @@ jobs:
23
26
  gemfile: gemfiles/activesupport_3.gemfile
24
27
  - rvm: 3.0.0
25
28
  gemfile: gemfiles/activesupport_4.gemfile
29
+ - rvm: 3.1.0
30
+ gemfile: gemfiles/activesupport_3.gemfile
31
+ - rvm: 3.1.0
32
+ gemfile: gemfiles/activesupport_4.gemfile
26
33
 
27
34
  before_install:
28
35
  - yes | gem update --system --force
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Change Log
2
2
  ==========
3
3
 
4
+ Version 0.5.0 *(2022-03-14)*
5
+ ----------------------------
6
+ Add #from method to Rule object
7
+
4
8
  Version 0.4.4 *(2022-03-01)*
5
9
  ----------------------------
6
10
  Remove constraint on ActiveSupport version
data/lib/rrule/rule.rb CHANGED
@@ -26,6 +26,11 @@ module RRule
26
26
  all_until(start_date: floored_start_date, end_date: floored_end_date, limit: limit).reject { |instance| instance < floored_start_date }
27
27
  end
28
28
 
29
+ def from(start_date, limit:)
30
+ floored_start_date = floor_to_seconds_in_timezone(start_date)
31
+ all_until(start_date: floored_start_date, limit: limit).reject { |instance| instance < floored_start_date }
32
+ end
33
+
29
34
  def each(floor_date: nil)
30
35
  # If we have a COUNT or INTERVAL option, we have to start at dtstart, because those are relative to dtstart
31
36
  floor_date = dtstart if count_or_interval_present? || floor_date.nil? || dtstart > floor_date
@@ -89,7 +94,14 @@ module RRule
89
94
  end
90
95
 
91
96
  def all_until(start_date: nil, end_date: max_date, limit: nil)
92
- limit ? take(limit) : each(floor_date: start_date).take_while { |date| date <= end_date }
97
+ count = 0
98
+ each(floor_date: start_date).take_while do |date|
99
+ if limit
100
+ date <= end_date && (count += 1) <= limit
101
+ else
102
+ date <= end_date
103
+ end
104
+ end
93
105
  end
94
106
 
95
107
  def parse_options(rule)
data/lib/rrule/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RRule
4
- VERSION = '0.4.4'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrule
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mitchell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-01 00:00:00.000000000 Z
11
+ date: 2022-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport