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.
The maximum allowed length of a content line without line end character.
# File lib/taskjuggler/ICalendar.rb, line 176 def initialize(uid) @uid = "#{AppConfig.packageName}-#{uid}" @creationDate = @lastModified = TjTime.new.utc @todos = [] @events = [] @journals = [] end
Add a new VEVENT component. For internal use only!
# File lib/taskjuggler/ICalendar.rb, line 191 def addEvent(event) @events << event end
Add a new VJOURNAL component. For internal user only!
# File lib/taskjuggler/ICalendar.rb, line 196 def addJournal(journal) @journals << journal end
Add a new VTODO component. For internal use only!
# File lib/taskjuggler/ICalendar.rb, line 186 def addTodo(todo) @todos << todo end
# File lib/taskjuggler/ICalendar.rb, line 218 def dateTime(date) date.to_s("%Y%m%dT%H%M%SZ") end
# File lib/taskjuggler/ICalendar.rb, line 200 def to_s str = "BEGIN:VCALENDAR PRODID:-//The #{AppConfig.softwareName} Project/NONSGML #{AppConfig.softwareName} #{AppConfig.version}//EN VERSION:2.0 " @todos.each { |todo| str += todo.to_s } @events.each { |event| str += event.to_s } @journals.each { |journal| str += journal.to_s } str << "END:VCALENDAR " foldLines(str) end