Class: Icalendar::Event

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

Overview

A Event calendar component is a grouping of component properties, and possibly including Alarm calendar components, that represents a scheduled amount of time on a calendar. For example, it can be an activity; such as a one-hour long, department meeting from 8:00 AM to 9:00 AM, tomorrow. Generally, an event will take up time on an individual calendar.

Constant Summary

Constants inherited from Component

Component::CAL_EXTENSION_REGEX

Instance Attribute Summary collapse

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_headers, #print_parameters, #print_properties, #print_subcomponents, #printer, #properties_to_print, #remove_component, #respond_to_missing?, #to_ical

Methods inherited from Base

debug, quiet

Constructor Details

#initializeEvent

Returns a new instance of Event.



106
107
108
109
110
111
112
113
# File 'lib/icalendar/component/event.rb', line 106

def initialize()
  super("VEVENT")

  # Now doing some basic initialization
  sequence 0
  timestamp Time.now.utc.to_datetime.tap { |t| t.icalendar_tzid = 'UTC' }
  uid new_uid
end

Dynamic Method Handling

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

Instance Attribute Details

#tzidObject

Specifies the timezone for the event



31
32
33
# File 'lib/icalendar/component/event.rb', line 31

def tzid
  @tzid
end

Instance Method Details

#alarm(&block) ⇒ Object



115
116
117
118
119
120
121
122
# File 'lib/icalendar/component/event.rb', line 115

def alarm(&block)
  a = Alarm.new
  self.add a

  a.instance_eval(&block) if block

  a
end

#occurrences_starting(time) ⇒ Object



124
125
126
# File 'lib/icalendar/component/event.rb', line 124

def occurrences_starting(time)
  recurrence_rules.first.occurrences_of_event_starting(self, time)
end