Class: Icalendar2::Timezone

Inherits:
Component::Base show all
Defined in:
lib/icalendar2/component/timezone.rb

Direct Known Subclasses

Daylight, Standard

Constant Summary collapse

VALUE =
"VTIMEZONE"

Instance Method Summary collapse

Methods inherited from Component::Base

accepts, #new_timestamp, #new_uid, requires, #set_property, #valid?

Constructor Details

#initializeTimezone

Returns a new instance of Timezone.



8
9
10
11
12
13
14
# File 'lib/icalendar2/component/timezone.rb', line 8

def initialize
  super
  @components = {
    Daylight::VALUE => [],
    Standard::VALUE => []
  }
end

Instance Method Details

#add_component(component) ⇒ Object



22
23
24
25
# File 'lib/icalendar2/component/timezone.rb', line 22

def add_component(component)
  key = component.class.to_s.downcase.gsub('icalendar::', '').to_sym
  @components[key] = component
end

#daylight(&block) ⇒ Object



31
32
33
# File 'lib/icalendar2/component/timezone.rb', line 31

def daylight(&block)
  daylight_time_c = Daylight.new
end

#standard(&block) ⇒ Object



27
28
29
# File 'lib/icalendar2/component/timezone.rb', line 27

def standard(&block)
  standard_time_c = Standard.new
end

#to_icalObject



16
17
18
19
20
# File 'lib/icalendar2/component/timezone.rb', line 16

def to_ical
  str = "#{Tokens::COMPONENT_BEGIN}:#{VALUE}#{Tokens::CRLF}"
  str << properties_to_ical
  str << "#{Tokens::COMPONENT_END}:#{VALUE}#{Tokens::CRLF}"
end