Class: Calagator::VEvent
- Inherits:
-
Struct
- Object
- Struct
- Calagator::VEvent
- Defined in:
- lib/calagator/vcalendar.rb
Instance Attribute Summary collapse
-
#ri_cal_event ⇒ Object
Returns the value of attribute ri_cal_event.
-
#vvenues ⇒ Object
Returns the value of attribute vvenues.
Instance Method Summary collapse
- #end_time ⇒ Object
- #old? ⇒ Boolean
-
#start_time ⇒ Object
translate the start and end dates correctly depending on whether it’s a floating or fixed timezone.
- #vvenue ⇒ Object
Instance Attribute Details
#ri_cal_event ⇒ Object
Returns the value of attribute ri_cal_event
33 34 35 |
# File 'lib/calagator/vcalendar.rb', line 33 def ri_cal_event @ri_cal_event end |
#vvenues ⇒ Object
Returns the value of attribute vvenues
33 34 35 |
# File 'lib/calagator/vcalendar.rb', line 33 def vvenues @vvenues end |
Instance Method Details
#end_time ⇒ Object
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
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_time ⇒ Object
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 |
#vvenue ⇒ Object
63 64 65 |
# File 'lib/calagator/vcalendar.rb', line 63 def vvenue vvenues.find { |venue| venue.uid == venue_uid } if venue_uid end |