Class: Blackbook::Exporter::Vcf

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

Overview

exports contacts in Vcard format

Defined Under Namespace

Classes: Vcard

Instance Method Summary collapse

Instance Method Details

#export(contacts = []) ⇒ Object

exports contacts as Vcards



35
36
37
38
39
40
41
42
# File 'lib/blackbook/exporter/vcf.rb', line 35

def export( contacts = [] )
  return if contacts.blank? 
  
  contacts.uniq.compact.collect do |contact|
    first_name, last_name = contact[:name].split(' ', 2)
    Vcard.new( :first => first_name.to_s, :last => last_name.to_s, :email => contact[:email])
  end
end