[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: iCal (ics) parser in Ruby
From:       unbewusst.sein () weltanschauung ! com ! invalid (=?ISO-8859-1?Q?Une_B=E9v?=
Date:       2007-09-30 16:45:12
Message-ID: 1i59nt5.curoed1bympjoN%unbewusst.sein () weltanschauung ! com ! invalid
[Download RAW message or body]

Jeremy Hinegardner <jeremy@hinegardner.org> wrote:

> 
> This all just means that the rdoc generation of the vpim gem has some
> incorrect generation options.  The the library itself is still
> installed.

OK, i've tried one of your first example :

----------------------------------------------------------------
#!/usr/bin/env ruby

require 'vpim/vcard'
require 'vpim/icalendar'

$in  = ARGV.first ? File.open(ARGV.shift) : $stdin
$out = ARGV.first ? File.open(ARGV.shift, 'w') : $stdout

cal = Vpim::Icalendar.create

Vpim::Vcard.decode($in).each do |card|
  if card.birthday
    cal.push Vpim::Icalendar::Vevent.create_yearly(
      card.birthday,
      "Birthday for #{card['fn'].strip}"
      )
    $stderr.puts "#{card['fn']} -> bday #{cal.events.last.dtstart}"
  end
end

puts cal.encode
----------------------------------------------------------------

calling it by :
./vcf-to-ics.rb Anais.vcf Anais.ics

having an error :
~/work/Ruby/vpim-0.9/essais%> ./vcf-to-ics.rb Anais.vcf Anais.ics
./vcf-to-ics.rb:12: undefined method `birthday' for
#<Vpim::Vcard:0x10d81c0> (NoMethodError)
        from ./vcf-to-ics.rb:11:in `each'
        from ./vcf-to-ics.rb:11

the vCard i've exported being with a birthdat field, name in french :
"date de naissance"

do you think this could be the prob (ie french localisation of
AddressBook) ???
-- 
Une Bévue

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic