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
37 38 39 |
# File 'lib/calagator/vcalendar.rb', line 37 def ri_cal_event @ri_cal_event end |
#vvenues ⇒ Object
Returns the value of attribute vvenues
37 38 39 |
# File 'lib/calagator/vcalendar.rb', line 37 def vvenues @vvenues end |
Instance Method Details
#end_time ⇒ Object
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
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_time ⇒ Object
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 |
#vvenue ⇒ Object
67 68 69 |
# File 'lib/calagator/vcalendar.rb', line 67 def vvenue vvenues.find { |venue| venue.uid == venue_uid } if venue_uid end |