Module: EventInstanceMethods
- Included in:
- Event, EventRevision
- Defined in:
- app/models/event_instance_methods.rb
Instance Attribute Summary collapse
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
Instance Method Summary collapse
- #date ⇒ Object
- #end_day ⇒ Object
- #end_hour ⇒ Object
- #end_min ⇒ Object
- #end_month ⇒ Object
- #end_year ⇒ Object
- #multi_day_date ⇒ Object
- #one_day? ⇒ Boolean
- #one_day_date ⇒ Object
- #start_day ⇒ Object
- #start_hour ⇒ Object
- #start_min ⇒ Object
- #start_month ⇒ Object
- #start_year ⇒ Object
Instance Attribute Details
#end_date ⇒ Object
Returns the value of attribute end_date.
2 3 4 |
# File 'app/models/event_instance_methods.rb', line 2 def end_date @end_date end |
#end_time ⇒ Object
Returns the value of attribute end_time.
2 3 4 |
# File 'app/models/event_instance_methods.rb', line 2 def end_time @end_time end |
#start_date ⇒ Object
Returns the value of attribute start_date.
2 3 4 |
# File 'app/models/event_instance_methods.rb', line 2 def start_date @start_date end |
#start_time ⇒ Object
Returns the value of attribute start_time.
2 3 4 |
# File 'app/models/event_instance_methods.rb', line 2 def start_time @start_time end |
Instance Method Details
#date ⇒ Object
67 68 69 |
# File 'app/models/event_instance_methods.rb', line 67 def date one_day? ? one_day_date : multi_day_date end |
#end_day ⇒ Object
56 57 58 |
# File 'app/models/event_instance_methods.rb', line 56 def end_day end_on.present? ? end_on.in_time_zone(timezone).day : end_on end |
#end_hour ⇒ Object
48 49 50 |
# File 'app/models/event_instance_methods.rb', line 48 def end_hour end_on.present? ? end_on.hour : end_on end |
#end_min ⇒ Object
52 53 54 |
# File 'app/models/event_instance_methods.rb', line 52 def end_min end_on.present? ? end_on.min : end_on end |
#end_month ⇒ Object
44 45 46 |
# File 'app/models/event_instance_methods.rb', line 44 def end_month end_on.present? ? end_on.in_time_zone(timezone).strftime("%B") : end_on end |
#end_year ⇒ Object
40 41 42 |
# File 'app/models/event_instance_methods.rb', line 40 def end_year end_on.present? ? end_on.year : end_on end |
#multi_day_date ⇒ Object
75 76 77 78 79 |
# File 'app/models/event_instance_methods.rb', line 75 def multi_day_date return one_day_date if end_on.blank? "#{start_on.in_time_zone(timezone).strftime('%A, %B %d')} - "+ "#{end_on.in_time_zone(timezone).strftime('%A, %B %d %Y')}" end |
#one_day? ⇒ Boolean
60 61 62 63 64 65 |
# File 'app/models/event_instance_methods.rb', line 60 def one_day? return true if start_on.blank? || end_on.blank? start_on.day == end_on.day && start_on.month== end_on.month && start_on.year == end_on.year end |
#one_day_date ⇒ Object
71 72 73 |
# File 'app/models/event_instance_methods.rb', line 71 def one_day_date start_on.in_time_zone(timezone).strftime('%A, %B %d %Y') end |
#start_day ⇒ Object
28 29 30 |
# File 'app/models/event_instance_methods.rb', line 28 def start_day start_on.present? ? start_on.in_time_zone(timezone).day : start_on end |
#start_hour ⇒ Object
32 33 34 |
# File 'app/models/event_instance_methods.rb', line 32 def start_hour start_on.present? ? start_on.hour : start_on end |
#start_min ⇒ Object
36 37 38 |
# File 'app/models/event_instance_methods.rb', line 36 def start_min start_on.present? ? start_on.min : start_on end |
#start_month ⇒ Object
24 25 26 |
# File 'app/models/event_instance_methods.rb', line 24 def start_month start_on.present? ? start_on.in_time_zone(timezone).strftime("%B") : start_on end |
#start_year ⇒ Object
20 21 22 |
# File 'app/models/event_instance_methods.rb', line 20 def start_year start_on.present? ? start_on.in_time_zone(timezone).year : start_on end |