Module: RST::Calendar::Eventable
- Included in:
- CalendarEvent
- Defined in:
- lib/modules/calendar/eventable.rb
Overview
Inject Eventable to any Class to make it event-able in a Calendar You have to define a method :event_headline for the class in order to list the event in a Calendar.
Instance Method Summary collapse
-
#event_date ⇒ Date
The date when the event is scheduled.
-
#event_headline ⇒ String
abstract
used in calendar-output as a short entry.
-
#schedule!(date) ⇒ Eventable
-
self.
-
-
#scheduled? ⇒ Boolean
True if the object is scheduled (has an event_date).
Instance Method Details
#event_date ⇒ Date
Returns the date when the event is scheduled.
27 28 29 |
# File 'lib/modules/calendar/eventable.rb', line 27 def event_date @event_date end |
#event_headline ⇒ String
This method is abstract.
-
overwrite in descendants
used in calendar-output as a short entry
46 47 48 |
# File 'lib/modules/calendar/eventable.rb', line 46 def event_headline self.inspect end |
#schedule!(date) ⇒ Eventable
Returns - self.
38 39 40 41 |
# File 'lib/modules/calendar/eventable.rb', line 38 def schedule!(date) @event_date = date.is_a?(Date) ? date : Date.parse(date) self end |
#scheduled? ⇒ Boolean
Returns true if the object is scheduled (has an event_date).
32 33 34 |
# File 'lib/modules/calendar/eventable.rb', line 32 def scheduled? !event_date.nil? end |