rrule 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: c26a3dfb1d12c01d066b7c664e6ea0da8fb5ead0
4
- data.tar.gz: 1975eaa5dacd0363518d155f994a9966b837f682
3
+ metadata.gz: cef0ad524f55bb65033204ddb1b134d6e9fb0c6f
4
+ data.tar.gz: 881e0c1e363a355b8908fb036568525e8b77dacf
5
5
  SHA512:
6
- metadata.gz: a9f362bd929a06f539e69df842cebb0052f3f841b624d36e01edb9dca64e4c5f472da54b3d671df6089a991b6b4bd1b0bbe39502409274d5636ab68a81e6ed22
7
- data.tar.gz: 70400ae4f025bcee80979056cfec688a16e5be6fd948a07d905fa9f5e48ec7d8f62df31d84f8d0181e001aa6ee27e89fb3c39250b6df85195eb91739876cc14a
6
+ metadata.gz: e3a41b83fbd8b90734f1b9c97d493f8e4fa2e6314e300603b6cb0d9949151d60a3bcc34073a03c37e2aeece752ec99e9633f5c5f48b9f9eadb445407f3e5abb3
7
+ data.tar.gz: d4a47101d49896dcc2ac9ab2108ae64c1873fc52f1bea394623508f8887d3c23748c728ffaede12a079b662f0da33256f5dd30970845e41348a12444b8b5d394
@@ -25,8 +25,5 @@ module RRule
25
25
  Rule.new(rrule, **options)
26
26
  end
27
27
 
28
- MAX_YEAR = 9999
29
- MAX_DATE = DateTime.new(MAX_YEAR)
30
-
31
28
  class InvalidRRule < StandardError; end
32
29
  end
@@ -4,11 +4,13 @@ module RRule
4
4
 
5
5
  attr_reader :dtstart, :tz, :exdate
6
6
 
7
- def initialize(rrule, dtstart: Time.now, tzid: 'UTC', exdate: [])
7
+ def initialize(rrule, dtstart: Time.now, tzid: 'UTC', exdate: [], max_year: nil)
8
8
  @dtstart = floor_to_seconds(dtstart).in_time_zone(tzid)
9
9
  @tz = tzid
10
10
  @exdate = exdate
11
11
  @options = parse_options(rrule)
12
+ @max_year = max_year || 9999
13
+ @max_date = DateTime.new(@max_year)
12
14
  end
13
15
 
14
16
  def all(limit: nil)
@@ -60,7 +62,7 @@ module RRule
60
62
  frequency = Frequency.for_options(options).new(context, filters, generator, timeset)
61
63
 
62
64
  loop do
63
- return if frequency.current_date.year > MAX_YEAR
65
+ return if frequency.current_date.year > max_year
64
66
 
65
67
  frequency.next_occurrences.each do |this_result|
66
68
  next if this_result < dtstart
@@ -77,7 +79,7 @@ module RRule
77
79
 
78
80
  private
79
81
 
80
- attr_reader :options
82
+ attr_reader :options, :max_year, :max_date
81
83
 
82
84
  def floor_to_seconds(date)
83
85
  # This removes all sub-second and floors it to the second level.
@@ -90,7 +92,7 @@ module RRule
90
92
  @enumerator ||= to_enum
91
93
  end
92
94
 
93
- def all_until(end_date: MAX_DATE, limit: nil)
95
+ def all_until(end_date: max_date, limit: nil)
94
96
  limit ? take(limit) : take_while { |date| date <= end_date }
95
97
  end
96
98
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rrule'
3
- s.version = '0.3.0'
4
- s.date = '2018-04-23'
3
+ s.version = '0.3.1'
4
+ s.date = '2018-04-24'
5
5
  s.summary = 'RRule expansion'
6
6
  s.description = 'A gem for expanding dates according to the RRule specification'
7
7
  s.authors = ['Ryan Mitchell']
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mitchell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-23 00:00:00.000000000 Z
11
+ date: 2018-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.6.11
110
+ rubygems_version: 2.5.2
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: RRule expansion