Class: SimpleVpim

Inherits:
Object
  • Object
show all
Defined in:
lib/simplevpim.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s) ⇒ SimpleVpim

Returns a new instance of SimpleVpim.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/simplevpim.rb', line 17

def initialize(s)

  kvx = Kvx.new(s)
  @h = kvx.to_h

  if s.lstrip =~ /# vcard/ and @h[:name] then
    
    @to_vcard = make_vcard @h
    @to_xml = vcard_xml @h      
    
  elsif @h[:title] or @h[:summary]
    
    @to_vevent = make_vevent @h
    @to_xml = vevent_xml kvx.to_xml
    
  end

end

Instance Attribute Details

#to_vcardObject (readonly) Also known as: to_vcf

Returns the value of attribute to_vcard.



15
16
17
# File 'lib/simplevpim.rb', line 15

def to_vcard
  @to_vcard
end

#to_veventObject (readonly)

Returns the value of attribute to_vevent.



15
16
17
# File 'lib/simplevpim.rb', line 15

def to_vevent
  @to_vevent
end

#to_xmlObject (readonly)

Returns the value of attribute to_xml.



15
16
17
# File 'lib/simplevpim.rb', line 15

def to_xml
  @to_xml
end

Instance Method Details

#to_hcard(layout = nil) ⇒ Object



38
39
40
# File 'lib/simplevpim.rb', line 38

def to_hcard(layout=nil)
  make_hcard layout, @h
end

#to_xcardObject



42
43
44
# File 'lib/simplevpim.rb', line 42

def to_xcard()
  make_xcard @to_xml    
end