Module: Icalendar::TimezoneTransition

Included in:
TZInfo::TimezoneTransition, TZInfo::TimezoneTransitionInfo
Defined in:
lib/icalendar/tzinfo.rb

Instance Method Summary collapse

Instance Method Details

#dtstartObject



78
79
80
# File 'lib/icalendar/tzinfo.rb', line 78

def dtstart
  (respond_to?(:local_start_at) ? local_start_at : local_start).to_datetime.strftime '%Y%m%dT%H%M%S'
end

#offset_abbreviationObject



59
60
61
# File 'lib/icalendar/tzinfo.rb', line 59

def offset_abbreviation
  offset.abbreviation.to_s
end

#offset_fromObject



51
52
53
# File 'lib/icalendar/tzinfo.rb', line 51

def offset_from
  previous_offset.ical_offset
end

#offset_toObject



55
56
57
# File 'lib/icalendar/tzinfo.rb', line 55

def offset_to
  offset.ical_offset
end

#rruleObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/icalendar/tzinfo.rb', line 63

def rrule
  start = (respond_to?(:local_start_at) ? local_start_at : local_start).to_datetime
  # this is somewhat of a hack, but seems to work ok
  # assumes that no timezone transition is in law as "4th X of the month"
  # but only as 1st X, 2nd X, 3rd X, or Last X
  start_week = ((start.day - 1) / 7).to_i + 1
  start_week = (start_week > 3) ? -1 : start_week
  [sprintf(
    'FREQ=YEARLY;BYMONTH=%d;BYDAY=%d%s',
    start.month,
    start_week,
    start.strftime('%a').upcase[0,2]
  )]
end