Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation on generating GEDCOM files #5

Open
mawise opened this issue Sep 13, 2020 · 4 comments
Open

Documentation on generating GEDCOM files #5

mawise opened this issue Sep 13, 2020 · 4 comments

Comments

@mawise
Copy link

mawise commented Sep 13, 2020

Hi @rbur004 ,

This looks like an awesome library! I know it's been years since you've looked at it. The Readme states you can both parse and produce GEDCOM files, but I can't find any references in the documentation for how to produce GEDCOM files.

Thanks!

Matt

@rbur004
Copy link
Owner

rbur004 commented Sep 13, 2020

File.open( "../test_data/TGC551LF.out", "w:ASCII-8BIT") do |file|
file.print g.transmissions[0].to_gedcom
end

@rbur004
Copy link
Owner

rbur004 commented Sep 13, 2020

Wrote it with the intent to create a web based gedcom editor. Got side tracked by life :) I do use it to read gedcom files, to use in www.burrowes.org to load and present my Family tree. Others have extended it to be an editor too, so look at their forks.

Also good for checking gedcom files syntax and all references are consistent.
`
require 'gedcom'

["burrowes.ged"].each do |source|
puts "parse #{source}"
g = Gedcom.file(dir + '/' + source, "r:ASCII-8BIT") #OK with LF line endings.
g.transmissions[0].summary
puts
puts "Self check of Gedcom consistency"
g.transmissions[0].self_check #validate the gedcom file just loaded, printing errors found.
puts
end

`

@mawise
Copy link
Author

mawise commented Sep 14, 2020 via email

@garz75
Copy link

garz75 commented Apr 27, 2022

Hello,

I have just discovered your gem when trying to generate a GEDCOM file from some Excel file my family created when starting to create the family tree.

From the above discussion, I could not understand if the current code is actually able to generate GEDCOM "from scratch".
I tried the trial-and-error approach (see note below), but did not manage to create a simple GEDCOM with only one individual in it.

So my questions are:

  • Does the current code support creating a GEDCOM from scratch ?
  • I looked at all the 9 forks on GitHub: none of them seems to have added this functionality as you mentioned above. Are there any forks on other source repositories ?

thank you in advance for your help.

Fred

Note:

I tried the naive approach :

require 'gedcom'

g = Gedcom.new

transmission = Transmission.new

g.transmissions = [ transmission ]

name_record = Name_record.new(transmission)

name_record.surname = "Garzon"
name_record.given = "Frederic"

ind = Individual_record.new(transmission)

ind.name_record = [ name_record ]

transmission.individual_record = [ ind ]

puts g.transmissions[0].to_gedcom

puts g.transmissions[0].self_check

The first puts shows nothing ( g.transmissions[0].to_gedcom is nil )

The second puts raise an exception:

Traceback (most recent call last):
        8: from /Users/garz/.rvm/rubies/ruby-2.7.5/bin/irb:23:in `<main>'
        7: from /Users/garz/.rvm/rubies/ruby-2.7.5/bin/irb:23:in `load'
        6: from /Users/garz/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        5: from (irb):22
        4: from /Users/garz/.rvm/gems/ruby-2.7.5@genealogy/gems/gedcom-0.9.4/lib/gedcom/transmission.rb:96:in `self_check'
        3: from /Users/garz/.rvm/gems/ruby-2.7.5@genealogy/gems/gedcom-0.9.4/lib/gedcom/transmission.rb:96:in `each'
        2: from /Users/garz/.rvm/gems/ruby-2.7.5@genealogy/gems/gedcom-0.9.4/lib/gedcom/transmission.rb:97:in `block in self_check'
        1: from /Users/garz/.rvm/gems/ruby-2.7.5@genealogy/gems/gedcom-0.9.4/lib/gedcom/individual_record.rb:547:in `self_check'
NoMethodError (undefined method `first' for nil:NilClass)

The nil object is the Individual_record#@individual_ref attribute. I have not looked into the entire source code yet but I guess I need an Xref for each record I create...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants