Class: Vcalendar

Inherits:
Vobject::Component show all
Defined in:
lib/vcalendar.rb

Instance Attribute Summary collapse

Attributes inherited from Vobject::Component

#errors, #multiple_components, #norm

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Vobject::Component

#<=>, #blank, #get_errors, #name, #to_hash, #to_json, #to_norm, #to_s

Constructor Details

#initialize(key, cs, err) ⇒ Vcalendar

Returns a new instance of Vcalendar.



16
17
18
# File 'lib/vcalendar.rb', line 16

def initialize(key, cs, err)
  super key, cs, err
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



8
9
10
# File 'lib/vcalendar.rb', line 8

def children
  @children
end

#comp_nameObject

Returns the value of attribute comp_name.



8
9
10
# File 'lib/vcalendar.rb', line 8

def comp_name
  @comp_name
end

#versionObject

Returns the value of attribute version.



8
9
10
# File 'lib/vcalendar.rb', line 8

def version
  @version
end

Class Method Details

.parse(vcf, strict) ⇒ Object



11
12
13
# File 'lib/vcalendar.rb', line 11

def parse(vcf, strict)
  Vobject::Component::Vcalendar.parse(vcf, strict)
end

Instance Method Details

#child_class(key, val) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vcalendar.rb', line 20

def child_class(key, val)
  base_class = if key == :VTODO
                 Vobject::Component::Vcalendar::ToDo
               elsif key == :VFREEBUSY
                 Vobject::Component::Vcalendar::FreeBusy
               elsif key == :JOURNAL
                 Vobject::Component::Vcalendar::Journal
               elsif key == :STANDARD
                 Vobject::Component::Vcalendar::Timezone::Standard
               elsif key == :DAYLIGHT
                 Vobject::Component::Vcalendar::Timezone::Daylight
               elsif key == :VTIMEZONE
                 Vobject::Component::Vcalendar::Timezone
               elsif key == :VEVENT
                 Vobject::Component::Vcalendar::Event
               elsif key == :VALARM
                 Vobject::Component::Vcalendar::Alarm
               elsif key == :VAVAILABILITY
                 Vobject::Component::Vcalendar::Vavailability
               elsif key == :AVAILABLE
                 Vobject::Component::Vcalendar::Vavailability::Available
               elsif !(val.is_a?(Hash) && !val.has_key?(:value))
                 property_base_class
               else
                 Vobject::Component::Vcalendar
               end
  return base_class if [:CLASS, :OBJECT, :METHOD].include?
  camelized_key = key.to_s.downcase.split("_").map(&:capitalize).join("")
  base_class.const_get(camelized_key) rescue base_class
end