Module: Icalendar::TimezoneTransition

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

Instance Method Summary collapse

Instance Method Details

#dtstartObject



80
81
82
# File 'lib/icalendar/tzinfo.rb', line 80

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

#offset_abbreviationObject



61
62
63
# File 'lib/icalendar/tzinfo.rb', line 61

def offset_abbreviation
  offset.abbreviation.to_s
end

#offset_fromObject



53
54
55
# File 'lib/icalendar/tzinfo.rb', line 53

def offset_from
  previous_offset.ical_offset
end

#offset_toObject



57
58
59
# File 'lib/icalendar/tzinfo.rb', line 57

def offset_to
  offset.ical_offset
end

#rruleObject



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

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