Class: TaskJuggler::ICalendar::Todo
- Defined in:
- lib/taskjuggler/ICalendar.rb
Overview
Stores the data of an VTODO component and can generate one.
Instance Attribute Summary collapse
-
#percentComplete ⇒ Object
Returns the value of attribute percentComplete.
-
#priority ⇒ Object
Returns the value of attribute priority.
Attributes inherited from Component
#description, #organizer, #relatedTo, #uid
Instance Method Summary collapse
-
#initialize(ical, uid, summary, startDate, endDate) ⇒ Todo
constructor
Create the Todo object with some mandatory data.
-
#to_s ⇒ Object
Generate the VTODO record as String.
Methods inherited from Component
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
#percentComplete ⇒ Object
Returns the value of attribute percentComplete.
98 99 100 |
# File 'lib/taskjuggler/ICalendar.rb', line 98 def percentComplete @percentComplete end |
#priority ⇒ Object
Returns the value of attribute priority.
98 99 100 |
# File 'lib/taskjuggler/ICalendar.rb', line 98 def priority @priority end |
Instance Method Details
#to_s ⇒ Object
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 |