Module: RST::Calendar

Defined in:
lib/modules/calendar/calendar.rb,
lib/modules/calendar/eventable.rb,
lib/modules/calendar/calendar_event.rb

Overview

Calendar-module provides the Calendar-class which is supposed to hold ‘Eventable’-objects. Where Eventable is a module you can include to any class. A Calendar has a start- and ending-date, and a name. The name is used to store the calendar in a store using this name as the id.

Examples:


class Person
  include Eventable

  def initialize name, dob
    @name = name
    schedule! dob
  end

  # override abstract method to format the output
  def event_headline
    '#{name}\'s Birthday'
  end
end

birthdays = Calendar.new('birthdays')
birthdays << Person.new('Andi',   '31. Aug. 1964')
birthdays << Person.new('Heidi',  '28. Aug. 1969')
birthdays << Person.new('Julian', '17. Feb. 1995')
birthdays << Person.new('Tina',   '22. May. 1997')

puts birthdays.list_days('31.8.1963','today') 
# => Mon, Aug 31 1964: Andi's Birthday
# => Thu, Aug 28 1969: Heidi's Birthday
# => Fri, Feb 17 1995: Julian's Birthday
# => Thu, May 22 1997: Tina's Birthday

See Also:

Defined Under Namespace

Modules: Eventable Classes: Calendar, CalendarEvent