Hosted at |
GEDCOM/Ruby Module |
[ Project Page / Downloads / CVS ]
Here's an example of how to use the module:
1 #!/usr/bin/ruby 2 3 require 'gedcom' 4 5 class Counter 6 attr_reader :count 7 8 def initialize 9 @count = 0 10 end 11 12 def increment 13 @count += 1 14 end 15 end 16 17 def count_person( data, cookie, parm ) 18 cookie.increment 19 end 20 21 counter = Counter.new 22 parser = GEDCOM::Parser.new( counter ) 23 24 parser.setPreHandler [ "INDI" ], method( :count_person ) 25 26 parser.parse( "myfam.ged" ) 27 28 puts "#{counter.count} individuals in the file"
-- Jamis Buck (jgb3 at email.byu.edu)