Class: TaskJuggler::ICalendar::Todo

Inherits:
Component show all
Defined in:
lib/taskjuggler/ICalendar.rb

Overview

Stores the data of an VTODO component and can generate one.

Instance Attribute Summary collapse

Attributes inherited from Component

#description, #organizer, #relatedTo, #uid

Instance Method Summary collapse

Methods inherited from Component

#addAttendee, #setOrganizer

Constructor Details

#initialize(ical, uid, summary, startDate, endDate) ⇒ Todo

Create the Todo object with some mandatory data. ical is a reference to the parent ICalendar object. uid is a unique pattern used to generate the UID tag. summary is a String for SUMMARY. startDate is used to generate DTSTART. endDate is used to either generate the COMPLETED or DUE tag.



105
106
107
108
109
110
111
112
113
114
# File 'lib/taskjuggler/ICalendar.rb', line 105

def initialize(ical, uid, summary, startDate, endDate)
  super(ical, uid, summary, startDate)

  # Mandatory attributes
  @ical.addTodo(self)
  @endDate = endDate
  # Priority value (0 - 9)
  @priority = 0
  @percentComplete = -1
end

Instance Attribute Details

#percentCompleteObject

Returns the value of attribute percentComplete.



98
99
100
# File 'lib/taskjuggler/ICalendar.rb', line 98

def percentComplete
  @percentComplete
end

#priorityObject

Returns the value of attribute priority.



98
99
100
# File 'lib/taskjuggler/ICalendar.rb', line 98

def priority
  @priority
end

Instance Method Details

#to_sObject

Generate the VTODO record as String.



117
118
119
120
121
122
123
124
125
126
127
# File 'lib/taskjuggler/ICalendar.rb', line 117

def to_s
  super do
    str = ''
    if @percentComplete < 100.0
      str += "DUE:#{dateTime(@endDate)}\n"
    else
      str += "COMPLETED:#{dateTime(@endDate)}\n"
    end
    str += "PERCENT-COMPLETE:#{@percentComplete}\n"
  end
end