File: event.rb

package info (click to toggle)
mhc 1.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,452 kB
  • sloc: ruby: 12,700; lisp: 7,577; makefile: 70; sh: 68
file content (58 lines) | stat: -rw-r--r-- 1,779 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
module RiCal
  class Component
    #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
    #
    # An Event (VEVENT) calendar component groups properties describing a scheduled event.
    # Events may have multiple occurrences
    #
    # Events may also contain one or more ALARM subcomponents
    #
    # to see the property accessing methods for this class see the RiCal::Properties::Event module
    # to see the methods for enumerating occurrences of recurring events see the RiCal::OccurrenceEnumerator module
    class Event < Component
      include OccurrenceEnumerator

      include RiCal::Properties::Event

      def subcomponent_class #:nodoc:
        {:alarm => Alarm }
      end

      def self.entity_name #:nodoc:
        "VEVENT"
      end
      
      # Return a date_time representing the time at which the event starts
      def start_time
        dtstart_property ? dtstart.to_datetime : nil
      end
      
      # Return a date_time_property representing the time at which the event ends
      def finish_property
        if dtend_property
          dtend_property
        elsif duration_property
          (dtstart_property + duration_property)
        else
          dtstart_property
        end
      end

      # Return a date_time representing the time at which the event starts
      def finish_time
        prop = finish_property
        prop ? prop.to_finish_time : nil
      end
      
      def zulu_occurrence_range_start_time
        dtstart_property ? dtstart_property.to_zulu_occurrence_range_start_time : nil
       end
      
      def zulu_occurrence_range_finish_time
        prop = finish_property
        prop ? prop.to_zulu_occurrence_range_finish_time : nil
      end
      
    end
  end
end