Class: Icalendar::Calendar
Constant Summary
Constants inherited
from Component
Icalendar::Component::CAL_EXTENSION_REGEX
Instance Attribute Summary
Attributes inherited from Component
#name, #properties
Instance Method Summary
collapse
Methods inherited from Component
#add_component, #chunk_lines, #custom_property, #escape_chars, #fix_conflict_with_built_in, #method_missing, #multi_property?, #multiline_property?, #new_uid, #print_component, #print_parameters, #print_properties, #print_subcomponents, #printer, #remove_component, #respond_to_missing?, #to_ical
Methods inherited from Base
debug, quiet
Constructor Details
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")
self.calscale = "GREGORIAN" self.prodid = "iCalendar-Ruby" self.version = "2.0" 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/icalendar/calendar.rb', line 36
def event(&block)
calendar_tzid = timezone_id
build_component Event.new do
self.tzid = calendar_tzid
if block
instance_eval(&block)
if tzid
dtstart.ical_params = { "TZID" => tzid }
dtend.ical_params = { "TZID" => tzid } unless dtend.nil?
end
end
end
end
|
#find_event(uid) ⇒ Object
52
53
54
|
# File 'lib/icalendar/calendar.rb', line 52
def find_event(uid)
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)
freebusys.find {|f| f.uid == uid}
end
|
#find_journal(uid) ⇒ Object
68
69
70
|
# File 'lib/icalendar/calendar.rb', line 68
def find_journal(uid)
journals.find {|j| j.uid == uid}
end
|
#find_todo(uid) ⇒ Object
60
61
62
|
# File 'lib/icalendar/calendar.rb', line 60
def find_todo(uid)
todos.find {|t| t.uid == uid}
end
|
#freebusy(&block) ⇒ Object
72
73
74
|
# File 'lib/icalendar/calendar.rb', line 72
def freebusy(&block)
build_component Freebusy.new, &block
end
|
#journal(&block) ⇒ Object
64
65
66
|
# File 'lib/icalendar/calendar.rb', line 64
def journal(&block)
build_component Journal.new, &block
end
|
28
29
30
|
# File 'lib/icalendar/calendar.rb', line 28
def
"VERSION:#{version}\r\n"
end
|
#properties_to_print ⇒ Object
32
33
34
|
# File 'lib/icalendar/calendar.rb', line 32
def properties_to_print
@properties.select { |k,v| k != 'version' }
end
|
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.
93
94
95
|
# File 'lib/icalendar/calendar.rb', line 93
def publish
self.ip_method = "PUBLISH"
end
|
#timezone(&block) ⇒ Object
80
81
82
|
# File 'lib/icalendar/calendar.rb', line 80
def timezone(&block)
build_component Timezone.new, &block
end
|
#todo(&block) ⇒ Object
56
57
58
|
# File 'lib/icalendar/calendar.rb', line 56
def todo(&block)
build_component Todo.new, &block
end
|