Class: Calagator::VEvent

Inherits:
Struct
  • Object
show all
Defined in:
lib/calagator/vcalendar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ri_cal_eventObject

Returns the value of attribute ri_cal_event

Returns:

  • (Object)

    the current value of ri_cal_event



33
34
35
# File 'lib/calagator/vcalendar.rb', line 33

def ri_cal_event
  @ri_cal_event
end

#vvenuesObject

Returns the value of attribute vvenues

Returns:

  • (Object)

    the current value of vvenues



33
34
35
# File 'lib/calagator/vcalendar.rb', line 33

def vvenues
  @vvenues
end

Instance Method Details

#end_timeObject



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/calagator/vcalendar.rb', line 51

def end_time
  if ri_cal_event.dtstart_property.tzid
    ri_cal_event.dtend
  elsif ri_cal_event.dtend_property
    Time.zone.parse(ri_cal_event.dtend_property.value)
  elsif ri_cal_event.duration
    ri_cal_event.duration_property.add_to_date_time_value(start_time)
  else
    start_time
  end
end

#old?Boolean

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/calagator/vcalendar.rb', line 34

def old?
  cutoff = Time.now.yesterday
  (ri_cal_event.dtend || ri_cal_event.dtstart).to_time < cutoff
end

#start_timeObject

translate the start and end dates correctly depending on whether it’s a floating or fixed timezone



43
44
45
46
47
48
49
# File 'lib/calagator/vcalendar.rb', line 43

def start_time
  if ri_cal_event.dtstart_property.tzid
    ri_cal_event.dtstart
  else
    Time.zone.parse(ri_cal_event.dtstart_property.value)
  end
end

#vvenueObject



63
64
65
# File 'lib/calagator/vcalendar.rb', line 63

def vvenue
  vvenues.find { |venue| venue.uid == venue_uid } if venue_uid
end