gedcom 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +74 -0
  3. data/README.txt +129 -0
  4. data/Rakefile +13 -0
  5. data/lib/gedcom.rb +105 -0
  6. data/lib/gedcom/address_record.rb +77 -0
  7. data/lib/gedcom/adoption_record.rb +57 -0
  8. data/lib/gedcom/association_record.rb +79 -0
  9. data/lib/gedcom/cause_record.rb +45 -0
  10. data/lib/gedcom/change_date_record.rb +39 -0
  11. data/lib/gedcom/character_set_record.rb +41 -0
  12. data/lib/gedcom/citation_data_record.rb +49 -0
  13. data/lib/gedcom/citation_event_type_record.rb +42 -0
  14. data/lib/gedcom/corporate_record.rb +36 -0
  15. data/lib/gedcom/date_record.rb +206 -0
  16. data/lib/gedcom/encoded_line_record.rb +34 -0
  17. data/lib/gedcom/event_age_record.rb +36 -0
  18. data/lib/gedcom/event_record.rb +258 -0
  19. data/lib/gedcom/events_list_record.rb +61 -0
  20. data/lib/gedcom/families_individuals.rb +79 -0
  21. data/lib/gedcom/family_record.rb +89 -0
  22. data/lib/gedcom/gedcom_all.rb +41 -0
  23. data/lib/gedcom/gedcom_base.rb +337 -0
  24. data/lib/gedcom/gedcom_record.rb +44 -0
  25. data/lib/gedcom/header_data_record.rb +49 -0
  26. data/lib/gedcom/header_record.rb +75 -0
  27. data/lib/gedcom/header_source_record.rb +42 -0
  28. data/lib/gedcom/individual_attribute_record.rb +86 -0
  29. data/lib/gedcom/individual_record.rb +128 -0
  30. data/lib/gedcom/multimedia_citation_record.rb +55 -0
  31. data/lib/gedcom/multimedia_record.rb +72 -0
  32. data/lib/gedcom/name_record.rb +58 -0
  33. data/lib/gedcom/note_citation_record.rb +37 -0
  34. data/lib/gedcom/note_record.rb +61 -0
  35. data/lib/gedcom/place_record.rb +46 -0
  36. data/lib/gedcom/refn_record.rb +32 -0
  37. data/lib/gedcom/repository_caln.rb +33 -0
  38. data/lib/gedcom/repository_citation_record.rb +43 -0
  39. data/lib/gedcom/repository_record.rb +41 -0
  40. data/lib/gedcom/source_citation_record.rb +74 -0
  41. data/lib/gedcom/source_record.rb +84 -0
  42. data/lib/gedcom/source_scope_record.rb +35 -0
  43. data/lib/gedcom/submission_record.rb +53 -0
  44. data/lib/gedcom/submitter_record.rb +53 -0
  45. data/lib/gedcom/text_record.rb +31 -0
  46. data/lib/gedcom/trailer_record.rb +22 -0
  47. data/lib/gedcom/transmission.rb +103 -0
  48. data/lib/gedcom/transmission_base.rb +267 -0
  49. data/lib/parser/class_tracker.rb +33 -0
  50. data/lib/parser/ged_line.rb +99 -0
  51. data/lib/parser/gedcom_parser.rb +798 -0
  52. data/lib/parser/instruction.rb +14 -0
  53. data/lib/parser/parse_state.rb +49 -0
  54. data/test/test_gedcom.rb +7 -0
  55. data/test_data/Document.RTF +1 -0
  56. data/test_data/Document.tex +1 -0
  57. data/test_data/ImgFile.BMP +0 -0
  58. data/test_data/ImgFile.GIF +0 -0
  59. data/test_data/ImgFile.JPG +0 -0
  60. data/test_data/ImgFile.MAC +0 -0
  61. data/test_data/ImgFile.PCX +0 -0
  62. data/test_data/ImgFile.PIC +0 -0
  63. data/test_data/ImgFile.PNG +0 -0
  64. data/test_data/ImgFile.PSD +0 -0
  65. data/test_data/ImgFile.TGA +0 -0
  66. data/test_data/ImgFile.TIF +0 -0
  67. data/test_data/README.txt +1 -16
  68. data/test_data/TGC551.ged +1 -0
  69. data/test_data/TGC551LF.ged +2162 -0
  70. data/test_data/TGC55C.ged +1 -0
  71. data/test_data/TGC55CLF.ged +2202 -0
  72. data/test_data/force.wav +0 -0
  73. data/test_data/suntun.mov +0 -0
  74. data/test_data/top.mpg +0 -0
  75. metadata +140 -0
@@ -0,0 +1,34 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #An inline Multimedia_record uses BLOB records to hold the data.
4
+ #This is unusual in practice, as it bloats the GEDCOM file.
5
+ #Normal practice is to reference a file or URL.
6
+ #
7
+ #=BLOB {BINARY_OBJECT}:=
8
+ # A grouping of data used as input to a multimedia system that processes binary data to represent
9
+ # images, sound, and video.
10
+ #
11
+ #=MULTIMEDIA_RECORD:=
12
+ # 0 @XREF:OBJE@ OBJE {0:M}
13
+ # ...
14
+ # n BLOB {1:1}
15
+ # +1 CONT <ENCODED_MULTIMEDIA_LINE> {1:M}
16
+ # ...
17
+ #
18
+ #The attributes are all arrays for the level +1 tags/records.
19
+ #* Those ending in _ref are GEDCOM XREF index keys
20
+ #* Those ending in _record are array of classes of that type.
21
+ #* The remainder are arrays of attributes that could be present in this record.
22
+ class Encoded_line_record < GEDCOMBase
23
+ attr_accessor :encoded_line
24
+
25
+ ClassTracker << :Encoded_line_record
26
+
27
+ #new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
28
+ def initialize(*a)
29
+ super(*a)
30
+ @this_level = [ [:nodata, "BLOB", nil ] ]
31
+ @sub_level = [ [:blob, "CONT", :encoded_line ] ]
32
+ end
33
+ end
34
+
@@ -0,0 +1,36 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #HUSB and WIFE tags can have an AGE record associated with them.
4
+ #
5
+ #=FAM_RECORD:=
6
+ # 0 @<XREF:FAM>@ FAM {0:M}
7
+ # 1 <<FAMILY_EVENT_STRUCTURE>> {0:M}
8
+ # n HUSB {0:1}
9
+ # +1 AGE <AGE_AT_EVENT> {1:1} ****
10
+ # n WIFE {0:1}
11
+ # +1 AGE <AGE_AT_EVENT> {1:1} ****
12
+ # ...
13
+ #
14
+ # I also recognise notes in this record, so I can handle user tags as notes.
15
+ # +1 <<NOTE_STRUCTURE>> {0:M}
16
+ #
17
+ #The attributes are all arrays for the level +1 tags/records.
18
+ #* Those ending in _ref are GEDCOM XREF index keys
19
+ #* Those ending in _record are array of classes of that type.
20
+ #* The remainder are arrays of attributes that could be present in this record.
21
+ class Event_age_record < GEDCOMBase
22
+ attr_accessor :relation, :age
23
+ attr_accessor :note_citation_record
24
+
25
+ ClassTracker << :Event_age_record
26
+
27
+ def to_gedcom(level=0)
28
+ @this_level = [ [:nodata, @relation[0], nil] ] #dynamic, so need to define after initialize method.
29
+ @sub_level = [ #level + 1
30
+ [:print, "AGE", :age],
31
+ [:walk, nil, :note_citation_record]
32
+ ]
33
+ super(level)
34
+ end
35
+ end
36
+
@@ -0,0 +1,258 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #Event_record holds multiple GEDCOM event record types. The type being held in @event_type.
4
+ #
5
+ #The following are all events and are stored in an Event_record object with their Tag as the @event_type:
6
+ #
7
+ #=FAMILY_EVENT_STRUCTURE:= {0:M}
8
+ # n [ ANUL | CENS | DIV | DIVF ] [Y|<NULL>] {1:1}
9
+ # +1 <<EVENT_DETAIL>> {0:1}
10
+ # n [ ENGA | MARR | MARB | MARC ] [Y|<NULL>] {1:1}
11
+ # +1 <<EVENT_DETAIL>> {0:1}
12
+ # n [ MARL | MARS ] [Y|<NULL>] {1:1}
13
+ # +1 <<EVENT_DETAIL>> {0:1}
14
+ # n EVEN {1:1}
15
+ # +1 <<EVENT_DETAIL>> {0:1}
16
+ #
17
+ #=INDIVIDUAL_EVENT_STRUCTURE:=
18
+ # n [ BIRT | CHR ] [Y|<NULL>] {1:1}
19
+ # +1 <<EVENT_DETAIL>> {0:1}
20
+ # +1 FAMC @<XREF:FAM>@ {0:1}
21
+ # n [ DEAT | BURI | CREM ] [Y|<NULL>] {1:1}
22
+ # +1 <<EVENT_DETAIL>> {0:1}
23
+ # n ADOP [Y|<NULL>] {1:1}
24
+ # +1 <<EVENT_DETAIL>> {0:1}
25
+ # +1 FAMC @<XREF:FAM>@ {0:1}
26
+ # +2 ADOP <ADOPTED_BY_WHICH_PARENT> {0:1}
27
+ # n [ BAPM | BARM | BASM | BLES ] [Y|<NULL>] {1:1}
28
+ # +1 <<EVENT_DETAIL>> {0:1}
29
+ # n [ CHRA | CONF | FCOM | ORDN ] [Y|<NULL>] {1:1}
30
+ # +1 <<EVENT_DETAIL>> {0:1}
31
+ # n [ NATU | EMIG | IMMI ] [Y|<NULL>] {1:1}
32
+ # +1 <<EVENT_DETAIL>> {0:1}
33
+ # n [ CENS | PROB | WILL] [Y|<NULL>] {1:1}
34
+ # +1 <<EVENT_DETAIL>> {0:1}
35
+ # n [ GRAD | RETI ] [Y|<NULL>] {1:1}
36
+ # +1 <<EVENT_DETAIL>> {0:1}
37
+ # n EVEN {1:1}
38
+ # +1 <<EVENT_DETAIL>> {0:1}
39
+ #
40
+ #=LDS_INDIVIDUAL_ORDINANCE:= {0:M}
41
+ # n [ BAPL | CONL ] {1:1}
42
+ # +1 STAT <LDS_BAPTISM_DATE_STATUS> {0:1}
43
+ # +1 DATE <DATE_LDS_ORD> {0:1}
44
+ # +1 TEMP <TEMPLE_CODE> {0:1}
45
+ # +1 PLAC <PLACE_LIVING_ORDINANCE> {0:1}
46
+ # +1 <<SOURCE_CITATION>> {0:M}
47
+ # +1 <<NOTE_STRUCTURE>> {0:M}
48
+ # n ENDL {1:1}
49
+ # +1 STAT <LDS_ENDOWMENT_DATE_STATUS> {0:1}
50
+ # +1 DATE <DATE_LDS_ORD> {0:1}
51
+ # +1 TEMP <TEMPLE_CODE> {0:1}
52
+ # +1 PLAC <PLACE_LIVING_ORDINANCE> {0:1}
53
+ # +1 <<SOURCE_CITATION>> {0:M}
54
+ # +1 <<NOTE_STRUCTURE>> {0:M}
55
+ # n SLGC {1:1}
56
+ # +1 STAT <LDS_CHILD_SEALING_DATE_STATUS> {0:1}
57
+ # +1 DATE <DATE_LDS_ORD> {0:1}
58
+ # +1 TEMP <TEMPLE_CODE> {0:1}
59
+ # +1 PLAC <PLACE_LIVING_ORDINANCE> {0:1}
60
+ # +1 FAMC @<XREF:FAM>@ {1:1}
61
+ # +1 <<SOURCE_CITATION>> {0:M}
62
+ # +1 <<NOTE_STRUCTURE>> {0:M}
63
+ #
64
+ #=LDS_SPOUSE_SEALING:=
65
+ # n SLGS {1:1}
66
+ # +1 STAT <LDS_SPOUSE_SEALING_DATE_STATUS> {0:1}
67
+ # +1 DATE <DATE_LDS_ORD> {0:1}
68
+ # +1 TEMP <TEMPLE_CODE> {0:1}
69
+ # +1 PLAC <PLACE_LIVING_ORDINANCE> {0:1}
70
+ # +1 <<SOURCE_CITATION>> {0:M}
71
+ # +1 <<NOTE_STRUCTURE>> {0:M}
72
+ #
73
+ # The EVEN tag in this structure is for recording general events or attributes that are not shown in the
74
+ # above <<INDIVIDUAL_EVENT_STRUCTURE>>. The general event or attribute type is declared
75
+ # by using a subordinate TYPE tag to show what event or attribute is recorded. For example, a
76
+ # candidate for state senate in the 1952 election could be recorded:
77
+ # 1 EVEN
78
+ # 2 TYPE Election
79
+ # 2 DATE 07 NOV 1952
80
+ # 2 NOTE Candidate for State Senate.
81
+ #
82
+ # The TYPE tag is also optionally used to modify the basic understanding of its superior event and is
83
+ # usually provided by the user. For example:
84
+ # 1 ORDN
85
+ # 2 TYPE Deacon
86
+ #
87
+ # The presence of a DATE tag and/or PLACe tag makes the assertion of when and/or where the event
88
+ # took place, and therefore that the event did happen. The absence of both of these tags require a
89
+ # Y(es) value on the parent TAG line to assert that the event happened. Using this convention protects
90
+ # GEDCOM processors which may remove (prune) lines that have no value and no subordinate lines.
91
+ # It also allows a note or source to be attached to the event context without implying that the event
92
+ # occurred.
93
+ #
94
+ # It is not proper to use a N(o) value with an event tag to infer that it did not happen. Inferring that an
95
+ # event did not occur would require a different tag. A symbol such as using an exclamation mark (!)
96
+ # preceding an event tag to indicate an event is known not to have happened may be defined in the future.
97
+ #
98
+ #=EVENT_DETAIL:= (These all get included in the Event_record as attributes)
99
+ # n TYPE <EVENT_DESCRIPTOR> {0:1}
100
+ # n DATE <DATE_VALUE> {0:1}
101
+ # n <<PLACE_STRUCTURE>> {0:1}
102
+ # n <<ADDRESS_STRUCTURE>> {0:1}
103
+ # n AGE <AGE_AT_EVENT> {0:1}
104
+ # n AGNC <RESPONSIBLE_AGENCY> {0:1}
105
+ # n CAUS <CAUSE_OF_EVENT> {0:1}
106
+ # n <<SOURCE_CITATION>> {0:M}
107
+ # n <<MULTIMEDIA_LINK>> {0:M}
108
+ # n <<NOTE_STRUCTURE>> {0:M}
109
+ #
110
+ #==AGE_AT_EVENT:= {Size=1:12}
111
+ # [ < | > | <NULL>] YYy MMm DDDd | YYy | MMm | DDDd | YYy MMm | YYy DDDd | MMm DDDd | CHILD | INFANT | STILLBORN
112
+ #
113
+ # Where:
114
+ # >:: greater than indicated age
115
+ # <:: less than indicated age
116
+ # y:: a label indicating years
117
+ # m:: a label indicating months
118
+ # d:: a label indicating days
119
+ # YY:: number of full years
120
+ # MM:: number of months
121
+ # DDD:: number of days
122
+ # CHILD:: age < 8 years
123
+ # INFANT:: age < 1 year
124
+ # STILLBORN:: died just prior, at, or near birth, 0 years
125
+ #
126
+ # A number that indicates the age in years, months, and days that the principal was at the time of the
127
+ # associated event. Any labels must come after their corresponding number, for example; 4y 8m 10d.
128
+ #
129
+ #==EVENT_DESCRIPTOR:= {Size=1:90}
130
+ # A descriptor that should be used whenever the EVEN tag is used to define the event being cited. For
131
+ # example, if the event was a purchase of a residence, the EVEN tag would be followed by a
132
+ # subordinate TYPE tag with the value "Purchased Residence." Using this descriptor with any of the
133
+ # other defined event tags basically classifies the basic definition of the associated tag but does not
134
+ # change its basic process. The form of using the TYPE tag with defined event tags has not been used
135
+ # by very many products. The MARR tag could be subordinated with a TYPE tag and
136
+ # EVENT_DESCRIPTOR value of Common Law. Other possible descriptor values might include
137
+ # "Childbirth—unmarried," "Common Law," or "Tribal Custom," for example. The event descriptor
138
+ # should use the same word or phrase and in the same language, when possible, as was used by the
139
+ # recorder of the event. Systems that display data from the GEDCOM form should be able to display the
140
+ # descriptor value in their screen or printed output.
141
+ #
142
+ #==RESPONSIBLE_AGENCY:= {Size=1:120}
143
+ # The organization, institution, corporation, person, or other entity that has authority or control
144
+ # interests in the associated context. For example, an employer of a person of an associated occupation,
145
+ # or a church that administered rites or events, or an organization responsible for creating and/or
146
+ # archiving records.
147
+ #
148
+ #==CAUSE_OF_EVENT:= {Size=1:90}
149
+ # Used in special cases to record the reasons which precipitated an event. Normally this will be used
150
+ # subordinate to a death event to show cause of death, such as might be listed on a death certificate.
151
+ #
152
+ #The attributes are all arrays for the level +1 tags/records.
153
+ #* Those ending in _ref are GEDCOM XREF index keys
154
+ #* Those ending in _record are array of classes of that type.
155
+ #* The remainder are arrays of attributes that could be present in this record.
156
+ class Event_record < GEDCOMBase
157
+ attr_accessor :restriction #not standard at the event level, but we might want this in DB.
158
+ attr_accessor :event_type, :event_descriptor
159
+ attr_accessor :event_status, :date_record, :phonenumber, :place_record, :address_record, :age
160
+ attr_accessor :agency, :cause_record, :source_citation_record, :submitter_ref
161
+ attr_accessor :multimedia_citation_record, :note_citation_record, :event_age_record, :adoption_record
162
+ attr_accessor :lds_temp_code, :lds_date_status, :lds_slgc_family_ref
163
+
164
+ ClassTracker << :Event_record
165
+
166
+ def initialize(*a)
167
+ super(*a)
168
+ @sub_level = [ #level + 1
169
+ [:print, "RESN", :restriction],
170
+ [:print, "TYPE", :event_descriptor],
171
+ [:print, "STAT", :lds_date_status],
172
+ [:walk, nil, :cause_record],
173
+ [:walk, nil, :date_record],
174
+ [:print, "TEMP", :lds_temp_code],
175
+ [:walk, nil, :place_record],
176
+ [:walk, nil, :address_record],
177
+ [:print, "PHON", :phonenumber],
178
+ [:print, "AGE", :age],
179
+ [:walk, nil, :event_age_record],
180
+ [:print, "AGNC", :agency],
181
+ [:walk, nil, :multimedia_citation_record],
182
+ [:walk, nil, :source_citation_record],
183
+ [:walk, nil, :note_citation_record],
184
+ [:xref, "SUBM", :submitter_ref],
185
+ [:walk, nil, :adoption_record],
186
+ [:xref, "FAMC", :lds_slgc_family_ref],
187
+ ]
188
+ end
189
+
190
+ def to_gedcom(level=0)
191
+ tag = event_tag(@event_type[0].to_s)
192
+
193
+ # print "'#{@event_type}' '#{@event_descriptor}' => #{tag}\n"
194
+ if @event_status != nil && @event_status[0] != nil && @event_status[0][0] != nil
195
+ @this_level = [ [:print, tag, :event_status] ]
196
+ else
197
+ @this_level = [ [:nodata, tag, nil] ]
198
+ end
199
+ super(level)
200
+ end
201
+
202
+ def event_tag(tag)
203
+ case tag
204
+ when "ANUL" then tag
205
+ when "CENS" then tag
206
+ when "DIV" then tag
207
+ when "DIVF" then tag
208
+ when "ENGA" then tag
209
+ when "MARR" then tag
210
+ when "MARB" then tag
211
+ when "MARC" then tag
212
+ when "MARL" then tag
213
+ when "MARS" then tag
214
+ when "EVEN" then tag
215
+ when "RESI" then tag
216
+ when "SLGS" then tag
217
+ when "BIRT" then tag
218
+ when "CHR" then tag
219
+ when "ADOP" then tag
220
+ when "DEAT" then tag
221
+ when "BURI" then tag
222
+ when "CREM" then tag
223
+ when "BAPM" then tag
224
+ when "BARM" then tag
225
+ when "BASM" then tag
226
+ when "BLES" then tag
227
+ when "CHRA" then tag
228
+ when "CONF" then tag
229
+ when "FCOM" then tag
230
+ when "ORDN" then tag
231
+ when "NATU" then tag
232
+ when "EMIG" then tag
233
+ when "IMMI" then tag
234
+ when "CENS" then tag
235
+ when "PROB" then tag
236
+ when "WILL" then tag
237
+ when "GRAD" then tag
238
+ when "RETI" then tag
239
+ when "BAPL" then tag
240
+ when "CONL" then tag
241
+ when "ENDL" then tag
242
+ when "SLGC" then tag
243
+ else "EVEN"
244
+ end
245
+ end
246
+
247
+ def is_event(tag)
248
+ @event_type.to_s == tag
249
+ end
250
+
251
+ def date
252
+ if @date_record != nil
253
+ @date_record[0].date
254
+ else
255
+ nil
256
+ end
257
+ end
258
+ end
@@ -0,0 +1,61 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #The SOURCE_RECORD's DATA tag has an EVEN record, which differs from the
4
+ #family or individual EVEN record type. It is a list of events that this
5
+ #source has data on, not the record of actual events.
6
+ #
7
+ #=SOURCE_RECORD:=
8
+ # 0 @<XREF:SOUR>@ SOUR {0:M}
9
+ # +1 DATA {0:1}
10
+ # +2 EVEN <EVENTS_RECORDED> {0:M} **This one**
11
+ # +3 DATE <DATE_PERIOD> {0:1}
12
+ # +3 PLAC <SOURCE_JURISDICTION_PLACE> {0:1}
13
+ # ...
14
+ # I also recognise notes in this record, so I can handle user tags as notes.
15
+ # +1 <<NOTE_STRUCTURE>> {0:M}
16
+ #
17
+ #==EVENTS_RECORDED:= {Size=1:90}
18
+ # [<EVENT_ATTRIBUTE_TYPE> |
19
+ # <EVENTS_RECORDED>, <EVENT_ATTRIBUTE_TYPE>]
20
+ # An enumeration of the different kinds of events that were recorded in a particular source. Each
21
+ # enumeration is separated by a comma. Such as a parish register of births, deaths, and marriages would
22
+ # be BIRT, DEAT, MARR.
23
+ #
24
+ #==SOURCE_JURISDICTION_PLACE:= {Size=1:120}
25
+ # <PLACE_VALUE>
26
+ # The name of the lowest jurisdiction that encompasses all lower-level places named in this source. For
27
+ # example, "Oneida, Idaho" would be used as a source jurisdiction place for events occurring in the
28
+ # various towns within Oneida County. "Idaho" would be the source jurisdiction place if the events
29
+ # recorded took place in other counties as well as Oneida County.
30
+ #
31
+ #==DATE_PERIOD:= {Size=7:35}
32
+ # FROM <DATE> |
33
+ # TO <DATE> |
34
+ # FROM <DATE> TO <DATE>
35
+ #
36
+ # Where:
37
+ # FROM = Indicates the beginning of a happening or state.
38
+ # TO = Indicates the ending of a happening or state.
39
+ #
40
+ #The attributes are all arrays for the level +1 tags/records.
41
+ #* Those ending in _ref are GEDCOM XREF index keys
42
+ #* Those ending in _record are array of classes of that type.
43
+ #* The remainder are arrays of attributes that could be present in this record.
44
+ class Events_list_record < GEDCOMBase
45
+ attr_accessor :recorded_events, :date_period, :place_record
46
+ attr_accessor :note_citation_record
47
+
48
+ ClassTracker << :Events_list_record
49
+
50
+ #new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
51
+ def initialize(*a)
52
+ super(*a)
53
+ @this_level = [ [:print, "EVEN", :recorded_events] ]
54
+ @sub_level = [ #level + 1
55
+ [:print, "DATE", :date_period],
56
+ [:walk, nil, :place_record],
57
+ [:walk, nil, :note_citation_record],
58
+ ]
59
+ end
60
+ end
61
+
@@ -0,0 +1,79 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #Family_individuals hold the FAMC and FAMS relationship between Individual_record and Family_record.
4
+ #
5
+ #=CHILD_TO_FAMILY_LINK:= (Identifies the family in which an individual appears as a child.)
6
+ # n FAMC @<XREF:FAM>@ {0:1}
7
+ # +1 PEDI <PEDIGREE_LINKAGE_TYPE> {0:M}
8
+ # +1 <<NOTE_STRUCTURE>> {0:M}
9
+ #
10
+ #=SPOUSE_TO_FAMILY_LINK:= (Identifies the family in which an individual appears as a spouse.)
11
+ # n FAMS @<XREF:FAM>@ {0:1}
12
+ # +1 <<NOTE_STRUCTURE>> {0:M}
13
+ #
14
+ #==PEDIGREE_LINKAGE_TYPE:= {Size=5:7}
15
+ # adopted | birth | foster | sealing
16
+ #
17
+ # A code used to indicate the child to family relationship for pedigree navigation purposes.
18
+ # Where:
19
+ # adopted:: indicates adoptive parents.
20
+ # birth:: indicates birth parents.
21
+ # foster:: indicates child was included in a foster or guardian family.
22
+ # sealing:: indicates child was sealed to parents other than birth parents.
23
+ #
24
+ # The normal lineage links are shown through the use of pointers from the individual to a family
25
+ # through either the FAMC tag or the FAMS tag. The FAMC tag provides a pointer to a family where
26
+ # this person is a child. The FAMS tag provides a pointer to a family where this person is a spouse or
27
+ # parent. The <<CHILD_TO_FAMILY_LINK>> (see page 27) structure contains a FAMC pointer
28
+ # which is required to show any child to parent linkage for pedigree navigation. The
29
+ # <<CHILD_TO_FAMILY_LINK>> structure also indicates whether the pedigree link represents a
30
+ # birth lineage, an adoption lineage, or a sealing lineage.
31
+ #
32
+ # Linkage between a child and the family they belonged to at the time of an event can also optionally
33
+ # be shown by a FAMC pointer subordinate to the appropriate event. For example, a FAMC pointer
34
+ # subordinate to an adoption event would show which family adopted this individual. Biological parent
35
+ # or parents can be indicated by a FAMC pointer subordinate to the birth event. The FAMC tag can
36
+ # also optionally be used subordinate to an ADOPtion, or BIRTh event to differentiate which set of
37
+ # parents were related by adoption, sealing, or birth.
38
+ #
39
+ #The attributes are all arrays for the level +1 tags/records.
40
+ #* Those ending in _ref are GEDCOM XREF index keys
41
+ #* Those ending in _record are array of classes of that type.
42
+ #* The remainder are arrays of attributes that could be present in this record.
43
+ class Families_individuals < GEDCOMBase
44
+ attr_accessor :relationship_type, :parents_family_ref, :family_ref, :pedigree
45
+ attr_accessor :note_citation_record
46
+ attr_accessor :source_citation_record #Only for FAMS (where did I get this idea from ?)
47
+
48
+ ClassTracker << :Families_individuals
49
+
50
+ def to_gedcom(level=0)
51
+ @this_level = [ [:xref, @relationship_type[0], :family_ref],
52
+ [:xref, @relationship_type[0], :parents_family_ref]
53
+ ]
54
+ @sub_level = [ #level 1
55
+ [:print, "PEDI", :pedigree ], #Only for FAMC
56
+ [:walk, nil, :source_citation_record ], #Only for FAMS (where did I get this idea from ?)
57
+ [:walk, nil, :note_citation_record ]
58
+ ]
59
+ super(level)
60
+ end
61
+
62
+ def parents_family
63
+ if @parents_family_ref != nil
64
+ find(:family, @parents_family_ref[0])
65
+ else
66
+ nil
67
+ end
68
+ end
69
+
70
+ def own_family
71
+ if @family_ref != nil
72
+ find(:family, @family_ref[0])
73
+ else
74
+ nil
75
+ end
76
+ end
77
+
78
+ end
79
+