Class: Icalendar::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/synchrograph/icalendar_monkey_patches/event.rb

Instance Method Summary collapse

Instance Method Details

#exdatesObject



12
13
14
# File 'lib/synchrograph/icalendar_monkey_patches/event.rb', line 12

def exdates
  exdate.map {|r| "EXDATE:#{[r].flatten.map {|s| s.value_with_tz.utc.strftime('%Y%m%dT%H%M%S')+'Z'}.join(',')}"}
end

#google_calendar_idObject



8
9
10
# File 'lib/synchrograph/icalendar_monkey_patches/event.rb', line 8

def google_calendar_id
  @gcal_id ||= UUIDTools::UUID.sha1_create(UUID_ICAL_TO_GCAL_NAMESPACE,uid).hexdigest
end

#google_calendar_id=(gcal_id) ⇒ Object



4
5
6
# File 'lib/synchrograph/icalendar_monkey_patches/event.rb', line 4

def google_calendar_id=(gcal_id)
  @gcal_id = gcal_id
end

#parent_componentObject



24
25
26
27
# File 'lib/synchrograph/icalendar_monkey_patches/event.rb', line 24

def parent_component
  return nil if recurrence_id.nil? 
  @parent_component ||=  parent.events.find {|p| p.recurrence_id.nil? and (p.uid == self.uid)}
end

#rdatesObject



16
17
18
# File 'lib/synchrograph/icalendar_monkey_patches/event.rb', line 16

def rdates
  rdate.map {|r| "RDATE:#{[r].flatten.map {|s| s.value_with_tz.utc.strftime('%Y%m%dT%H%M%S')+'Z'}.join(',')}"}
end

#update_from_parent_component!Object



29
30
31
32
33
34
35
36
# File 'lib/synchrograph/icalendar_monkey_patches/event.rb', line 29

def update_from_parent_component!
  return if parent_component.nil?

  [:summary, :description, :location, :geo].each do |desc_prop|
    self.send("#{desc_prop}=".to_sym, parent_component.send(desc_prop)) if self.send(desc_prop).nil? 
  end

end