Class: SimpleVpim
- Inherits:
-
Object
- Object
- SimpleVpim
- Defined in:
- lib/simplevpim.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#to_vcard ⇒ Object
(also: #to_vcf)
readonly
Returns the value of attribute to_vcard.
-
#to_vevent ⇒ Object
readonly
Returns the value of attribute to_vevent.
-
#to_xml ⇒ Object
readonly
Returns the value of attribute to_xml.
Instance Method Summary collapse
-
#initialize(rawobj, debug: false) ⇒ SimpleVpim
constructor
A new instance of SimpleVpim.
- #to_hcard(layout = nil) ⇒ Object
- #to_xcard ⇒ Object
Constructor Details
#initialize(rawobj, debug: false) ⇒ SimpleVpim
Returns a new instance of SimpleVpim.
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/simplevpim.rb', line 22 def initialize(rawobj, debug: false) @debug = debug obj = if block_given? then if rawobj == :event then e = Event.new yield e e.to_h elsif rawobj == :contact then puts 'inside contact' if @debug c = Contact.new yield c c.to_h end else rawobj end puts 'obj: ' + obj.inspect if @debug kvx = Kvx.new(obj, debug: false) @h = kvx.to_h if @h[:name] or @h[:firstname] or @h[:lastname] then @to_vcard = make_vcard @h @to_xml = vcard_xml @h elsif @h[:start] @to_vevent = make_vevent @h @to_xml = vevent_xml kvx.to_xml end end |
Instance Attribute Details
#to_vcard ⇒ Object (readonly) Also known as: to_vcf
Returns the value of attribute to_vcard.
16 17 18 |
# File 'lib/simplevpim.rb', line 16 def to_vcard @to_vcard end |
#to_vevent ⇒ Object (readonly)
Returns the value of attribute to_vevent.
16 17 18 |
# File 'lib/simplevpim.rb', line 16 def to_vevent @to_vevent end |
#to_xml ⇒ Object (readonly)
Returns the value of attribute to_xml.
16 17 18 |
# File 'lib/simplevpim.rb', line 16 def to_xml @to_xml end |
Instance Method Details
#to_hcard(layout = nil) ⇒ Object
71 72 73 |
# File 'lib/simplevpim.rb', line 71 def to_hcard(layout=nil) make_hcard layout, @h end |
#to_xcard ⇒ Object
75 76 77 |
# File 'lib/simplevpim.rb', line 75 def to_xcard() make_xcard @to_xml end |