Class: Blackbook::Exporter::Vcf::Vcard

Inherits:
Object
  • Object
show all
Defined in:
lib/blackbook/exporter/vcf.rb

Overview

representation of a vcard

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Vcard

initialize dynamically sets the attributes passed in as accessible attribute on its object



16
17
18
# File 'lib/blackbook/exporter/vcf.rb', line 16

def initialize( attributes = {} )
  attributes.each{ |name,value| self.send("#{name}=", value) rescue next }
end

Instance Attribute Details

#emailObject

Returns the value of attribute email.



10
11
12
# File 'lib/blackbook/exporter/vcf.rb', line 10

def email
  @email
end

#firstObject

Returns the value of attribute first.



10
11
12
# File 'lib/blackbook/exporter/vcf.rb', line 10

def first
  @first
end

#lastObject

Returns the value of attribute last.



10
11
12
# File 'lib/blackbook/exporter/vcf.rb', line 10

def last
  @last
end

Instance Method Details

#to_sObject

text representation of this vcard



22
23
24
25
26
27
28
29
# File 'lib/blackbook/exporter/vcf.rb', line 22

def to_s
  <<-EOVC
BEGIN:VCARD
N:#{last};#{first}
EMAIL:#{email}
END:VCARD
  EOVC
end