Module: Taskwarrior::Calendar::Event

Included in:
Taskwarrior::Calendar
Defined in:
lib/taskwarrior/calendar/event.rb

Instance Method Summary collapse

Instance Method Details

#add_event(event, task, type, alarm) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/taskwarrior/calendar/event.rb', line 9

def add_event(event, task, type, alarm)
  date = Icalendar::Values::DateTime.new(
    tz_info.utc_to_local(DateTime.parse(task[type])),
    'tzid' => tz_name
  )
  event.dtstart = event.dtend = date

  event.summary = "#{type.capitalize}: #{task['description']}"
  event.ip_class = 'PRIVATE'
  event.uid = task['uuid']

  add_event_alarm(event, task, type) if alarm
end