Class: Icalendar::Calendar

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

Instance Attribute Summary

Attributes inherited from Component

#name, #properties

Instance Method Summary collapse

Methods inherited from Component

#add_component, #custom_property, #multi_property?, #multiline_property?, #new_uid, #print_component, #print_parameters, #print_properties, #remove_component, #respond_to?, #to_ical

Methods inherited from Base

debug, quiet

Constructor Details

#initializeCalendar

Returns a new instance of Calendar.



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

def initialize()
  super("VCALENDAR")

  # 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 by apps that use the library
  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



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

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

  e.instance_eval &block if block

  e
end

#find_event(uid) ⇒ Object



37
38
39
# File 'lib/icalendar/calendar.rb', line 37

def find_event(uid)
  self.events.find {|e| e.uid == uid}
end

#find_freebusy(uid) ⇒ Object



76
77
78
# File 'lib/icalendar/calendar.rb', line 76

def find_freebusy(uid)
  self.freebusys.find {|f| f.uid == uid}
end

#find_journal(uid) ⇒ Object



63
64
65
# File 'lib/icalendar/calendar.rb', line 63

def find_journal(uid)
  self.journals.find {|j| j.uid == uid}
end

#find_todo(uid) ⇒ Object



50
51
52
# File 'lib/icalendar/calendar.rb', line 50

def find_todo(uid)
  self.todos.find {|t| t.uid == uid}
end

#freebusy(&block) ⇒ Object



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

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

  e.instance_eval &block if block

  e
end

#journal(&block) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/icalendar/calendar.rb', line 54

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

  e.instance_eval &block if block

  e
end

#publishObject

The “PUBLISH” method in a “VEVENT” calendar component is an unsolicited posting of an iCalendar object. Any CU may add published components to their calendar. The “Organizer” MUST be present in a published iCalendar component. “Attendees” MUST NOT be present. Its expected usage is for encapsulating an arbitrary event as an iCalendar object. The “Organizer” may subsequently update (with another “PUBLISH” method), add instances to (with an “ADD” method), or cancel (with a “CANCEL” method) a previously published “VEVENT” calendar component.



98
99
100
101
# File 'lib/icalendar/calendar.rb', line 98

def publish
  ip_method = "PUBLISH"

end

#timezone(&block) ⇒ Object



80
81
82
83
84
85
86
87
# File 'lib/icalendar/calendar.rb', line 80

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

  e.instance_eval &block if block

  e
end

#todo(&block) ⇒ Object



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

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

  e.instance_eval &block if block

  e
end