Class: TZInfo::TimezonePeriod

Inherits:
Object
  • Object
show all
Defined in:
lib/icalendar/tzinfo.rb

Instance Method Summary collapse

Instance Method Details

#daylightObject

For DST, use the start_transition, for standard TZ, use the following period (starting from the end_transition).



136
137
138
139
140
141
142
143
144
145
146
# File 'lib/icalendar/tzinfo.rb', line 136

def daylight
  transition = dst? ? start_transition : end_transition
  day = Icalendar::Timezone::Daylight.new
  build_timezone(day, transition) do |tz|
    # rrule should not be set for the current [==DST/daylight] period
    # if there is no recurrence rule for the end transition
    if !dst? || !end_transition.nil?
      tz.rrule = transition.rrule
    end
  end
end

#singleObject



160
161
162
163
164
165
166
167
# File 'lib/icalendar/tzinfo.rb', line 160

def single
  Icalendar::Timezone::Standard.new.tap do |std|
    std.tzname = abbreviation.to_s
    std.tzoffsetfrom = offset.ical_offset
    std.tzoffsetto = offset.ical_offset
    std.dtstart = DateTime.new(1970).strftime '%Y%m%dT%H%M%S'
  end
end

#standardObject

For standard TZ, use the start_transition, for DST, use the following period, (starting from the end_transition)



150
151
152
153
154
155
156
157
158
# File 'lib/icalendar/tzinfo.rb', line 150

def standard
  transition = dst? ? end_transition : start_transition
  std = Icalendar::Timezone::Standard.new
  build_timezone(std, transition) do |tz|
    if dst? || !end_transition.nil?
      tz.rrule = transition.rrule
    end
  end
end