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).



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

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



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

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)



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

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