Class: RiCal::PropertyValue::OccurrenceList::Enumerator
- Defined in:
- lib/ri_cal/property_value/occurrence_list.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#default_duration ⇒ Object
Returns the value of attribute default_duration.
-
#occurrence_list ⇒ Object
Returns the value of attribute occurrence_list.
Instance Method Summary collapse
- #bounded? ⇒ Boolean
- #empty? ⇒ Boolean
-
#initialize(occurrences, component) ⇒ Enumerator
constructor
TODO: the component parameter should always be the parent.
- #next_occurrence ⇒ Object
Constructor Details
#initialize(occurrences, component) ⇒ Enumerator
TODO: the component parameter should always be the parent
14 15 16 17 18 |
# File 'lib/ri_cal/property_value/occurrence_list.rb', line 14 def initialize(occurrences, component) # :nodoc: self.occurrence_list = occurrences self.default_duration = component.default_duration @index = 0 end |
Instance Attribute Details
#default_duration ⇒ Object
Returns the value of attribute default_duration.
11 12 13 |
# File 'lib/ri_cal/property_value/occurrence_list.rb', line 11 def default_duration @default_duration end |
#occurrence_list ⇒ Object
Returns the value of attribute occurrence_list.
11 12 13 |
# File 'lib/ri_cal/property_value/occurrence_list.rb', line 11 def occurrence_list @occurrence_list end |
Instance Method Details
#bounded? ⇒ Boolean
20 21 22 |
# File 'lib/ri_cal/property_value/occurrence_list.rb', line 20 def bounded? true end |
#empty? ⇒ Boolean
24 25 26 |
# File 'lib/ri_cal/property_value/occurrence_list.rb', line 24 def empty? occurrence_list.empty? end |
#next_occurrence ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/ri_cal/property_value/occurrence_list.rb', line 28 def next_occurrence if @index < occurrence_list.length result = occurrence_list[@index].occurrence_period(default_duration) @index += 1 result else nil end end |