class TaskJuggler::ICalendar::Todo

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

Attributes

percentComplete[RW]
priority[RW]

Public Class Methods

new(ical, uid, summary, startDate, endDate) click to toggle source

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.

Calls superclass method TaskJuggler::ICalendar::Component::new
# 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

Public Instance Methods

to_s() click to toggle source

Generate the VTODO record as String.

Calls superclass method TaskJuggler::ICalendar::Component#to_s
# 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