icalendar 2.5.0 → 2.5.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
  SHA256:
3
- metadata.gz: 3f6d533875d40bbe7fe5f4ceedffb05f31207bf5e54fa9680f395c206c0e9a88
4
- data.tar.gz: 85a0ddde7183fe00d00b3d71cb92ed2678ac7b34f63d9ffbbad20f03cc4adf6e
3
+ metadata.gz: 1a5b21473741cf53f97e0855df7898df74760fd9c4941dea1a9876cb91dfdc95
4
+ data.tar.gz: 743ad24dbf1057eee1a676c3de5184a52e481d5c88a8d96bb16bccb8fc002a12
5
5
  SHA512:
6
- metadata.gz: f645517ee3cb6960432f420c76edf0592c98b066d38ca893f66d04eb97d38e72853cdafe31835609750011dc0939dafbeaa0dc96337396418edbe9a830462ccf
7
- data.tar.gz: b99f6e61e505a27b275c3da7555cf2017e891be6debcff89d045c5852d9e7ae0e88192c66b8134b221db6e8d3bb0c502f3b0c4cfa1186bdb0e3e280a11f56383
6
+ metadata.gz: 3e139149e08d9d8bc25dfb0fd03a6e0e029ecfc31112751128f2f020767207ee8b17b2d9e000f9197dbca0650171836e1ef5c470e8f613684ba6dea88013dda6
7
+ data.tar.gz: 4a9ff7fcdc3f81b9252cef04f8211a90e71142b94e093b2b95dcbf15b631b576fbcd5ef937cb38ba62a94e22565d8d6f8583b42ceee34d51fc8e42de139ca932
@@ -1,3 +1,6 @@
1
+ === 2.5.1 2018-10-30
2
+ * Fix usage without ActiveSupport installed.
3
+
1
4
  === 2.5.0 2018-09-10
2
5
  * Set timezone information from VTIMEZONE components in cases that ActiveSupport can't figure it out (or isn't installed)
3
6
  * Prevent rewinding the Parser IO input during parsing - Niels Laukens
@@ -75,7 +75,7 @@ module Icalendar
75
75
 
76
76
  def standard_for(local)
77
77
  possible = standards.map do |std|
78
- schedule = IceCube::Schedule.new(std.dtstart) do |s|
78
+ schedule = IceCube::Schedule.new(std.dtstart.to_time) do |s|
79
79
  std.rrule.each do |rule|
80
80
  s.add_recurrence_rule IceCube::Rule.from_ical(rule.value_ical)
81
81
  end
@@ -90,7 +90,7 @@ module Icalendar
90
90
 
91
91
  def daylight_for(local)
92
92
  possible = daylights.map do |day|
93
- schedule = IceCube::Schedule.new(day.dtstart) do |s|
93
+ schedule = IceCube::Schedule.new(day.dtstart.to_time) do |s|
94
94
  day.rrule.each do |rule|
95
95
  s.add_recurrence_rule IceCube::Rule.from_ical(rule.value_ical)
96
96
  end
@@ -43,6 +43,10 @@ module Icalendar
43
43
  end
44
44
  end
45
45
 
46
+ def utc?
47
+ value.respond_to?(:utc?) ? value.utc? : value.to_time.utc?
48
+ end
49
+
46
50
  class FormatError < ArgumentError
47
51
  end
48
52
  end
@@ -19,14 +19,19 @@ module Icalendar
19
19
  params = Icalendar::DowncasedHash(params)
20
20
  @tz_utc = params['tzid'] == 'UTC'
21
21
 
22
- offset_value = if params['tzid'].present?
22
+ offset_value = unless params['tzid'].nil?
23
23
  tzid = params['tzid'].is_a?(::Array) ? params['tzid'].first : params['tzid']
24
24
  if defined?(ActiveSupport::TimeZone) &&
25
25
  defined?(ActiveSupportTimeWithZoneAdapter) &&
26
26
  (tz = ActiveSupport::TimeZone[tzid])
27
27
  ActiveSupportTimeWithZoneAdapter.new(nil, tz, value)
28
28
  elsif (tz = TimezoneStore.retrieve(tzid))
29
- value.change offset: tz.offset_for_local(value).to_s
29
+ offset = tz.offset_for_local(value).to_s
30
+ if value.respond_to?(:change)
31
+ value.change offset: offset
32
+ else
33
+ ::Time.new(value.year, value.month, value.day, value.hour, value.min, value.sec, offset)
34
+ end
30
35
  end
31
36
  end
32
37
  super((offset_value || value), params)
@@ -1,5 +1,5 @@
1
1
  module Icalendar
2
2
 
3
- VERSION = '2.5.0'
3
+ VERSION = '2.5.1'
4
4
 
5
5
  end
@@ -81,18 +81,18 @@ describe Icalendar do
81
81
  it 'sorts time events by start time' do
82
82
  events = subject.sort_by(&:dtstart)
83
83
 
84
- expect(events.first.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
84
+ expect(events.first.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
85
85
 
86
- expect(events.last.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 1, 0, '-4')
87
- expect(events.last.dtend).to eq ::DateTime.new(2014, 7, 14, 9, 59, 0, '-4')
86
+ expect(events.last.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 1, 0, '-4')
87
+ expect(events.last.dtend.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 59, 0, '-4')
88
88
  end
89
89
 
90
90
  it 'sorts time events by end time' do
91
91
  events = subject.sort_by(&:dtend)
92
92
 
93
- expect(events.first.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 1, 0, '-4')
94
- expect(events.first.dtend).to eq ::DateTime.new(2014, 7, 14, 9, 59, 0, '-4')
95
- expect(events.last.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
93
+ expect(events.first.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 1, 0, '-4')
94
+ expect(events.first.dtend.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 59, 0, '-4')
95
+ expect(events.last.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
96
96
  end
97
97
  end
98
98
 
@@ -103,8 +103,8 @@ describe Icalendar do
103
103
  it 'sorts time events' do
104
104
  events = subject.sort_by(&:dtstart)
105
105
 
106
- expect(events.first.dtstart).to eq ::Date.new(2014, 7, 14)
107
- expect(events.last.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
106
+ expect(events.first.dtstart.to_date).to eq ::Date.new(2014, 7, 14)
107
+ expect(events.last.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
108
108
  end
109
109
  end
110
110
 
@@ -29,12 +29,13 @@ describe 'TZInfo::Timezone' do
29
29
  let(:tz) { TZInfo::Timezone.get 'Asia/Shanghai' }
30
30
  let(:date) { DateTime.now }
31
31
 
32
+ # TODO only run this test with tzinfo ≥ 1.0
32
33
  it 'only creates a standard component' do
33
34
  expect(subject.to_ical).to eq <<-EXPECTED.gsub "\n", "\r\n"
34
35
  BEGIN:VTIMEZONE
35
36
  TZID:Asia/Shanghai
36
37
  BEGIN:STANDARD
37
- DTSTART:19910914T230000
38
+ DTSTART:19910915T010000
38
39
  TZOFFSETFROM:+0900
39
40
  TZOFFSETTO:+0800
40
41
  TZNAME:CST
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icalendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ahearn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-10 00:00:00.000000000 Z
11
+ date: 2018-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ice_cube