Class: RiCal::Component::Timezone::TimezonePeriod
- Inherits:
-
RiCal::Component
- Object
- RiCal::Component
- RiCal::Component::Timezone::TimezonePeriod
- Includes:
- OccurrenceEnumerator, Properties::TimezonePeriod
- Defined in:
- lib/ri_cal/component/timezone/timezone_period.rb
Overview
A TimezonePeriod is a component of a timezone representing a period during which a particular offset from UTC is in effect.
to see the property accessing methods for this class see the RiCal::Properties::TimezonePeriod module
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from RiCal::Component
Instance Method Summary collapse
-
#dtend ⇒ Object
:nodoc:.
- #enumeration_instance ⇒ Object
-
#exdate_property ⇒ Object
:nodoc:.
-
#exrule_property ⇒ Object
:nodoc:.
- #fill_cache(local_time) ⇒ Object
-
#last_before_local(local_time) ⇒ Object
:nodoc:.
-
#last_before_utc(utc_time) ⇒ Object
:nodoc:.
-
#occurrence_cache ⇒ Object
:nodoc:.
-
#utc_total_offset ⇒ Object
:nodoc:.
-
#zone_identifier ⇒ Object
:nodoc:.
Methods included from OccurrenceEnumerator
#after_range?, #before_range?, #bounded?, #default_duration, #default_start_time, #each, #occurrences, #recurrence, #recurs?, #set_occurrence_properties!, #zulu_occurrence_range
Methods included from Properties::TimezonePeriod
#==, #add_comment, #add_comments, #add_date_times_to, #add_rdate, #add_rdates, #add_rrule, #add_rrules, #add_tzname, #add_tznames, #comment, #comment=, #comment_property, #comment_property=, #comment_property_from_string, #comments=, #dtstart, #dtstart=, #dtstart_property, #dtstart_property=, #dtstart_property_from_string, #export_properties_to, included, #initialize_copy, #mutual_exclusion_violation, #rdate, #rdate=, #rdate_property, #rdate_property=, #rdate_property_from_string, #rdates=, #remove_comment, #remove_comments, #remove_rdate, #remove_rdates, #remove_rrule, #remove_rrules, #remove_tzname, #remove_tznames, #rrule, #rrule=, #rrule_property, #rrule_property=, #rrule_property_from_string, #rrules=, #tzname, #tzname=, #tzname_property, #tzname_property=, #tzname_property_from_string, #tznames=, #tzoffsetfrom, #tzoffsetfrom=, #tzoffsetfrom_property, #tzoffsetfrom_property=, #tzoffsetfrom_property_from_string, #tzoffsetto, #tzoffsetto=, #tzoffsetto_property, #tzoffsetto_property=, #tzoffsetto_property_from_string
Methods inherited from RiCal::Component
#add_property_date_times_to, #add_subcomponent, #add_x_property, #alarms, #daylight, #default_tzid, entity_name, #entity_name, #export, #export_prop_to, #export_subcomponent_to, #export_to, #export_x_properties_to, #find_timezone, from_parser, #imported?, #initialize, #initialize_copy, #last_period, #method_missing, parse, parse_string, #parse_subcomponent, #process_line, #prop_string, #standard, #subcomponent_class, #subcomponents, #time_zone_for, #to_s, #tz_info_source?, #valid?, #x_properties
Constructor Details
This class inherits a constructor from RiCal::Component
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RiCal::Component
Instance Method Details
#dtend ⇒ Object
:nodoc:
21 22 23 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 21 def dtend #:nodoc: nil end |
#enumeration_instance ⇒ Object
67 68 69 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 67 def enumeration_instance @enumeration_instance ||= super end |
#exdate_property ⇒ Object
:nodoc:
25 26 27 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 25 def exdate_property #:nodoc: nil end |
#exrule_property ⇒ Object
:nodoc:
33 34 35 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 33 def exrule_property #:nodoc: nil end |
#fill_cache(local_time) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 41 def fill_cache(local_time) if occurrence_cache.empty? || occurrence_cache.last.dtstart_property <= local_time while true occurrence = enumeration_instance.next_occurrence break unless occurrence occurrence = recurrence(occurrence) occurrence_cache << occurrence break if occurrence.dtstart_property > local_time end end end |
#last_before_local(local_time) ⇒ Object
:nodoc:
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 53 def last_before_local(local_time) #:nodoc: if recurs? fill_cache(local_time) cand_occurrence = nil occurrence_cache.each do |occurrence| return cand_occurrence if occurrence.dtstart_property > local_time cand_occurrence = occurrence end return cand_occurrence else return self end end |
#last_before_utc(utc_time) ⇒ Object
:nodoc:
37 38 39 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 37 def last_before_utc(utc_time) #:nodoc: last_before_local(utc_time + tzoffsetfrom_property) end |
#occurrence_cache ⇒ Object
:nodoc:
13 14 15 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 13 def occurrence_cache #:nodoc: @occurrence_cache ||= [] end |
#utc_total_offset ⇒ Object
:nodoc:
29 30 31 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 29 def utc_total_offset #:nodoc: tzoffsetto_property.to_seconds end |
#zone_identifier ⇒ Object
:nodoc:
17 18 19 |
# File 'lib/ri_cal/component/timezone/timezone_period.rb', line 17 def zone_identifier #:nodoc: tzname.first end |