Sha256: ea8f2cb2fa9727208dbfc54544f70313af811e6e1d73f4198091a3b0c547cb82

Contents?: true

Size: 878 Bytes

Versions: 24

Compression:

Stored size: 878 Bytes

Contents

# Note that while most version 3.0 vCards should be valid 2.1 vCards, they
# aren't guaranteed to be. vCard 2.1 is reasonably well supported on decode,
# I'm not sure how well it works on encode.
#
# Most things should work, but you should test whether this works with your 2.1
# vCard decoder. Also, avoid base64 encoding, or do it manually.
require 'vpim/vcard'

# Create a new 2.1 vCard.
card21 = Vpim::DirectoryInfo.create(
  [
    Vpim::DirectoryInfo::Field.create('VERSION', '2.1')
  ], 'VCARD')

Vpim::Vcard::Maker.make2(card21) do |maker|
  maker.name do |n|
    n.prefix = 'Dr.'
    n.given = 'Jimmy'
    n.family = 'Death'
  end

end

puts card21

# Copy and modify a 2.1 vCard, preserving it's version.
mod21 = Vpim::Vcard::Maker.make2(Vpim::DirectoryInfo.create([], 'VCARD')) do |maker|
  maker.copy card21
  maker.nickname = 'some name'
end

puts '---'
puts mod21

Version data entries

24 entries across 24 versions & 11 rubygems

Version Path
vpim-0.695 samples/ex_mkv21vcard.rb
vpim-0.619 samples/ex_mkv21vcard.rb
vpim-0.602 samples/ex_mkv21vcard.rb
vpim-0.658 samples/ex_mkv21vcard.rb