File: todo.rb

package info (click to toggle)
mhc 1.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,320 kB
  • ctags: 3,529
  • sloc: ruby: 12,404; lisp: 7,448; makefile: 70; sh: 69
file content (42 lines) | stat: -rw-r--r-- 1,287 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
module RiCal
  class Component
    #- ©2009 Rick DeNatale
    #- All rights reserved. Refer to the file README.txt for the license
    #
    # A Todo (VTODO) calendar component groups properties describing a to-do
    # Todos may have multiple occurrences
    #
    # Todos may also contain one or more ALARM subcomponents
    # to see the property accessing methods for this class see the RiCal::Properties::Todo module
    # to see the methods for enumerating occurrences of recurring to-dos see the RiCal::OccurrenceEnumerator module
    class Todo < Component
      include Properties::Todo
      include OccurrenceEnumerator

      def self.entity_name #:nodoc:
        "VTODO"
      end

      def subcomponent_class #:nodoc:
        {:alarm => Alarm }
      end
      
      # Return a date_time representing the time at which the todo should start
      def start_time
        dtstart_property ? dtstart.to_datetime : nil
      end
      
      # Return a date_time representing the time at which the todo is due
      def finish_time
        if due
          due_property.to_finish_time
        elsif duration_property && dtstart_property
          (dtstart_property + duration_property).to_finish_time
        else
          nil
        end
      end
      
    end
  end
end