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



37
38
39
# File 'lib/calagator/vcalendar.rb', line 37

def ri_cal_event
  @ri_cal_event
end

#vvenuesObject

Returns the value of attribute vvenues

Returns:

  • (Object)

    the current value of vvenues



37
38
39
# File 'lib/calagator/vcalendar.rb', line 37

def vvenues
  @vvenues
end

Instance Method Details

#end_timeObject



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/calagator/vcalendar.rb', line 55

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)


38
39
40
41
# File 'lib/calagator/vcalendar.rb', line 38

def old?
  cutoff = Time.now.in_time_zone.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



47
48
49
50
51
52
53
# File 'lib/calagator/vcalendar.rb', line 47

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



67
68
69
# File 'lib/calagator/vcalendar.rb', line 67

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