Class: TaskJuggler::ICalendar
Overview
This class implements a very basic RFC5545 compliant iCalendar file generator. It currently only supports a very small subset of the tags that are needed for TaskJuggler.
Defined Under Namespace
Classes: Component, Event, Journal, Person, Todo
Constant Summary collapse
- LINELENGTH =
The maximum allowed length of a content line without line end character.
75
Instance Attribute Summary collapse
-
#creationDate ⇒ Object
Returns the value of attribute creationDate.
-
#lastModified ⇒ Object
Returns the value of attribute lastModified.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
Instance Method Summary collapse
-
#addEvent(event) ⇒ Object
Add a new VEVENT component.
-
#addJournal(journal) ⇒ Object
Add a new VJOURNAL component.
-
#addTodo(todo) ⇒ Object
Add a new VTODO component.
- #dateTime(date) ⇒ Object
-
#initialize(uid) ⇒ ICalendar
constructor
A new instance of ICalendar.
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#creationDate ⇒ Object
Returns the value of attribute creationDate.
176 177 178 |
# File 'lib/taskjuggler/ICalendar.rb', line 176 def creationDate @creationDate end |
#lastModified ⇒ Object
Returns the value of attribute lastModified.
176 177 178 |
# File 'lib/taskjuggler/ICalendar.rb', line 176 def lastModified @lastModified end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
175 176 177 |
# File 'lib/taskjuggler/ICalendar.rb', line 175 def uid @uid end |
Instance Method Details
#addEvent(event) ⇒ Object
Add a new VEVENT component. For internal use only!
193 194 195 |
# File 'lib/taskjuggler/ICalendar.rb', line 193 def addEvent(event) @events << event end |
#addJournal(journal) ⇒ Object
Add a new VJOURNAL component. For internal user only!
198 199 200 |
# File 'lib/taskjuggler/ICalendar.rb', line 198 def addJournal(journal) @journals << journal end |
#addTodo(todo) ⇒ Object
Add a new VTODO component. For internal use only!
188 189 190 |
# File 'lib/taskjuggler/ICalendar.rb', line 188 def addTodo(todo) @todos << todo end |
#dateTime(date) ⇒ Object
220 221 222 |
# File 'lib/taskjuggler/ICalendar.rb', line 220 def dateTime(date) date.to_s("%Y%m%dT%H%M%SZ", 'UTC') end |
#to_s ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/taskjuggler/ICalendar.rb', line 202 def to_s str = <<"EOT" BEGIN:VCALENDAR PRODID:-//The #{AppConfig.softwareName} Project/NONSGML #{AppConfig.softwareName} #{AppConfig.version}//EN VERSION:2.0 EOT @todos.each { |todo| str += todo.to_s } @events.each { |event| str += event.to_s } @journals.each { |journal| str += journal.to_s } str << <<"EOT" END:VCALENDAR EOT foldLines(str) end |