Class: Icalendar::Calendar

Inherits:
Component show all
Defined in:
lib/icalendar/calendar.rb

Instance Attribute Summary

Attributes inherited from Component

#name, #properties, #property_params

Instance Method Summary collapse

Methods inherited from Component

#add_component, #custom_property, #multi_property?, #print_component, #print_parameter, #print_properties, #respond_to?, #to_ical

Constructor Details

#initializeCalendar

Returns a new instance of Calendar.



19
20
21
22
23
24
25
26
27
28
# File 'lib/icalendar/calendar.rb', line 19

def initialize()
  super("VCALENDAR")
  @properties = {}
  @property_params = {}

  # Set some defaults
  self.calscale = "GREGORIAN"    # Who knows, but this is the only one in the spec.
  self.prodid = "iCalendar-Ruby" # Current product... Should be overwritten
  self.version = "2.0" # Version of the specification
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Icalendar::Component

Instance Method Details

#event(&block) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/icalendar/calendar.rb', line 30

def event(&block)
  e = Event.new
  self.add_component e

  e.instance_eval &block if block

  e
end

#freebusy(&block) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/icalendar/calendar.rb', line 57

def freebusy(&block)
  e = Freebusy.new
  self.add_component e

  e.instance_eval &block if block

  e
end

#journal(&block) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/icalendar/calendar.rb', line 48

def journal(&block)
  e = Journal.new
  self.add_component e

  e.instance_eval &block if block

  e
end

#timezone(&block) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/icalendar/calendar.rb', line 66

def timezone(&block)
  e = Timezone.new
  self.add_component e

  e.instance_eval &block if block

  e
end

#todo(&block) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/icalendar/calendar.rb', line 39

def todo(&block)
  e = Todo.new
  self.add_component e

  e.instance_eval &block if block

  e
end