Class: Icalendar::Calendar
- Defined in:
- lib/icalendar/calendar.rb
Instance Attribute Summary collapse
-
#events ⇒ Object
Returns the value of attribute events.
-
#freebusys ⇒ Object
Returns the value of attribute freebusys.
-
#journals ⇒ Object
Returns the value of attribute journals.
-
#timezones ⇒ Object
Returns the value of attribute timezones.
-
#todos ⇒ Object
Returns the value of attribute todos.
Attributes inherited from Component
#name, #properties, #property_params
Instance Method Summary collapse
- #add(component) ⇒ Object
-
#initialize ⇒ Calendar
constructor
A new instance of Calendar.
- #to_s ⇒ Object
Methods inherited from Component
#method_missing, #print_string
Constructor Details
#initialize ⇒ Calendar
Returns a new instance of Calendar.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/icalendar/calendar.rb', line 6 def initialize() super("VCALENDAR") @properties = {} @property_params = {} @events = [] @todos = [] @journals = [] @freebusys = [] @timezones = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Icalendar::Component
Instance Attribute Details
#events ⇒ Object
Returns the value of attribute events.
4 5 6 |
# File 'lib/icalendar/calendar.rb', line 4 def events @events end |
#freebusys ⇒ Object
Returns the value of attribute freebusys.
4 5 6 |
# File 'lib/icalendar/calendar.rb', line 4 def freebusys @freebusys end |
#journals ⇒ Object
Returns the value of attribute journals.
4 5 6 |
# File 'lib/icalendar/calendar.rb', line 4 def journals @journals end |
#timezones ⇒ Object
Returns the value of attribute timezones.
4 5 6 |
# File 'lib/icalendar/calendar.rb', line 4 def timezones @timezones end |
#todos ⇒ Object
Returns the value of attribute todos.
4 5 6 |
# File 'lib/icalendar/calendar.rb', line 4 def todos @todos end |
Instance Method Details
#add(component) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/icalendar/calendar.rb', line 18 def add(component) if component.is_a? Event @events << component elsif component.is_a? Todo @todos << component elsif component.is_a? Journal @journals << component elsif component.is_a? Freebusy @freebusys << component elsif component.is_a? Timezone @timezones << component else raise InvalidComponentClass end end |
#to_s ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/icalendar/calendar.rb', line 34 def to_s print_string do |s| @events.each { |event| s << event.to_s } @todos.each { |todo| s << todo.to_s } @journals.each { |journal| s << journal.to_s } @freebusys.each { |freebusy| s << freebusy.to_s } @timezones.each { |timezone| s << timezone.to_s } end end |