class RST::Calendar::CalendarEvent

A CalendarEvent happens on a given date and has a label. It can be used in a Calendar @see Calendar::Calendar @see Calendar::Eventable @example

calendar = Calendar::Calendar.new('my calendar')
event = Calendar::CalendarEvent.new( 'today', "I'm happy" )
calendar << event
calendar.format_events_for(Date.today) 
  => "Sun, Mar 17 2013: I'm happy"
calendar << Calendar::CalendarEvent.new('2013-03-18', "Back to work :(")
calendar.list_days('today','4/2013')
  => Sun, Mar 17 2013: I'm happy
  => Mon, Mar 18 2013: Back to work :(

Attributes

event_date[R]
id[R]
label[R]

Public Class Methods

new(_date,_label) click to toggle source

@param [String|Date] _date - Date of the event (only all-day-events are possible yet) @param [String] _label - Events name

# File lib/modules/calendar/calendar_event.rb, line 30
def initialize(_date,_label)
  @label = _label
  @id ||= SecureRandom::hex(4)
  schedule! parse_date_param(_date)
end

Public Instance Methods

event_headline() click to toggle source

override abstract method for an Eventable

# File lib/modules/calendar/calendar_event.rb, line 37
def event_headline
  self.label.to_s.strip
end