Class: Family_record
- Inherits:
-
GEDCOMBase
- Object
- GEDCOMBase
- Family_record
- Defined in:
- lib/gedcom/family_record.rb
Overview
Family_record is the internal representation of a level 0 GEDCOM FAM record.
=FAM_RECORD:= 0 @<XREF:FAM>@ FAM 0:M +1 <<FAMILY_EVENT_STRUCTURE>> 0:M p.28 +2 HUSB 0:1 +3 AGE <AGE_AT_EVENT> 1:1 p.35 +2 WIFE 0:1 +3 AGE <AGE_AT_EVENT> 1:1 +1 HUSB @<XREF:INDI>@ 0:1 p.52 +1 WIFE @<XREF:INDI>@ 0:1 p.52 +1 CHIL @<XREF:INDI>@ 0:M p.52 +1 NCHI <COUNT_OF_CHILDREN> 0:1 p.37 +1 SUBM @<XREF:SUBM>@ 0:M p.52 +1 <<LDS_SPOUSE_SEALING>> 0:M p.30 +1 <<SOURCE_CITATION>> 0:M p.32 +1 <<MULTIMEDIA_LINK>> 0:M p.30,23 +1 <<NOTE_STRUCTURE>> 0:M p.31 +1 REFN <USER_REFERENCE_NUMBER> 0:M p.51 +2 TYPE <USER_REFERENCE_TYPE> 0:1 p.51 +1 RIN <AUTOMATED_RECORD_ID> 0:1 p.36 +1 <<CHANGE_DATE>> 0:1 p.27
The FAMily record is used to record marriages, common law marriages, and family unions caused by two people becoming the parents of a child (i.e they may not be married). There can be no more than one HUSB/father and one WIFE/mother listed in each FAM_RECORD. We are recording parentage, rather than marriages per se. If, for example, a man participated in more than one family union (or with more than 1 wife) then he would appear in more than one FAM_RECORD. The family record structure assumes that the HUSB/father is male and WIFE/mother is female. Again, as we are recording parentage, and we can't yet clone or reproduce from two males. or from two females.
The preferred order of the CHILdren pointers within a FAMily structure is chronological by birth.
The attributes are all arrays for the level +1 tags/records. * Those ending in ref are GEDCOM XREF index keys * Those ending in record are array of classes of that type. * The remainder are arrays of attributes that could be present in this record.
Instance Attribute Summary collapse
-
#automated_record_id ⇒ Object
Returns the value of attribute automated_record_id.
-
#change_date_record ⇒ Object
Returns the value of attribute change_date_record.
-
#child_ref ⇒ Object
Returns the value of attribute child_ref.
-
#event_record ⇒ Object
Returns the value of attribute event_record.
-
#family_ref ⇒ Object
Returns the value of attribute family_ref.
-
#husband_ref ⇒ Object
Returns the value of attribute husband_ref.
-
#multimedia_citation_record ⇒ Object
Returns the value of attribute multimedia_citation_record.
-
#note_citation_record ⇒ Object
Returns the value of attribute note_citation_record.
-
#number_children ⇒ Object
Returns the value of attribute number_children.
-
#refn_record ⇒ Object
Returns the value of attribute refn_record.
-
#restriction ⇒ Object
not standard at the event level, but we might want this in DB.
-
#source_citation_record ⇒ Object
Returns the value of attribute source_citation_record.
-
#submitter_ref ⇒ Object
Returns the value of attribute submitter_ref.
-
#wife_ref ⇒ Object
Returns the value of attribute wife_ref.
Instance Method Summary collapse
-
#annulment(&p) ⇒ Object
Short hand for event('ANUL') passes on any block to the event method.
-
#census(&p) ⇒ Object
Short hand for event('CENS') passes on any block to the event method.
-
#children ⇒ Object
Returns an array of children, or if a block is present, yields them one by one.
-
#divorce(&p) ⇒ Object
Short hand for event('DIV') passes on any block to the event method.
-
#divorce_filed(&p) ⇒ Object
Short hand for event('DIVF') passes on any block to the event method.
-
#engagement(&p) ⇒ Object
Short hand for event('ENGA') passes on any block to the event method.
-
#event(type) ⇒ Object
Event looks in the Family_record for events, as specified by the type argument, returning an array of the events found.
-
#husband ⇒ Object
There should only ever be one husband record in a Family_record.
- #id ⇒ Object
-
#initialize(*a) ⇒ Family_record
constructor
new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
-
#marriage(&p) ⇒ Object
Short hand for event('MARR') passes on any block to the event method.
-
#marriage_bann(&p) ⇒ Object
Short hand for event('MARB') passes on any block to the event method.
-
#marriage_contract(&p) ⇒ Object
Short hand for event('MARC') passes on any block to the event method.
-
#marriage_license(&p) ⇒ Object
Short hand for event('MARL') passes on any block to the event method.
-
#marriage_settlement(&p) ⇒ Object
Short hand for event('MARS') passes on any block to the event method.
-
#self_check ⇒ Object
Check the xrefs are valid.
-
#wife ⇒ Object
There should only ever be one wife record in a Family_record.
Methods inherited from GEDCOMBase
#changed, #changed?, #created?, #find, #locked?, no_tabs, #private?, #save, tabs, #to_db, #to_gedcom, #to_s, #to_s_ordered, #to_s_r, #token_to_s, #xref_check
Constructor Details
#initialize(*a) ⇒ Family_record
new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/gedcom/family_record.rb', line 49 def initialize(*a) super(*a) @this_level = [ [:xref, "FAM", :family_ref] ] @sub_level = [ #level + 1 [:xref, "HUSB", :husband_ref], [:xref, "WIFE", :wife_ref], [:xref, "CHIL", :child_ref], [:print, "NCHI", :number_children], [:walk, nil, :event_record], [:xref, "SUBM", :submitter_ref], [:walk, nil, :multimedia_citation_record], [:walk, nil, :source_citation_record], [:walk, nil, :note_citation_record], [:walk, nil, :refn_record], [:print, "RIN", :automated_record_id], [:walk, nil, :change_date_record], ] end |
Instance Attribute Details
#automated_record_id ⇒ Object
Returns the value of attribute automated_record_id.
44 45 46 |
# File 'lib/gedcom/family_record.rb', line 44 def automated_record_id @automated_record_id end |
#change_date_record ⇒ Object
Returns the value of attribute change_date_record.
44 45 46 |
# File 'lib/gedcom/family_record.rb', line 44 def change_date_record @change_date_record end |
#child_ref ⇒ Object
Returns the value of attribute child_ref.
42 43 44 |
# File 'lib/gedcom/family_record.rb', line 42 def child_ref @child_ref end |
#event_record ⇒ Object
Returns the value of attribute event_record.
42 43 44 |
# File 'lib/gedcom/family_record.rb', line 42 def event_record @event_record end |
#family_ref ⇒ Object
Returns the value of attribute family_ref.
42 43 44 |
# File 'lib/gedcom/family_record.rb', line 42 def family_ref @family_ref end |
#husband_ref ⇒ Object
Returns the value of attribute husband_ref.
42 43 44 |
# File 'lib/gedcom/family_record.rb', line 42 def husband_ref @husband_ref end |
#multimedia_citation_record ⇒ Object
Returns the value of attribute multimedia_citation_record.
43 44 45 |
# File 'lib/gedcom/family_record.rb', line 43 def multimedia_citation_record @multimedia_citation_record end |
#note_citation_record ⇒ Object
Returns the value of attribute note_citation_record.
44 45 46 |
# File 'lib/gedcom/family_record.rb', line 44 def note_citation_record @note_citation_record end |
#number_children ⇒ Object
Returns the value of attribute number_children.
42 43 44 |
# File 'lib/gedcom/family_record.rb', line 42 def number_children @number_children end |
#refn_record ⇒ Object
Returns the value of attribute refn_record.
44 45 46 |
# File 'lib/gedcom/family_record.rb', line 44 def refn_record @refn_record end |
#restriction ⇒ Object
not standard at the event level, but we might want this in DB.
41 42 43 |
# File 'lib/gedcom/family_record.rb', line 41 def restriction @restriction end |
#source_citation_record ⇒ Object
Returns the value of attribute source_citation_record.
43 44 45 |
# File 'lib/gedcom/family_record.rb', line 43 def source_citation_record @source_citation_record end |
#submitter_ref ⇒ Object
Returns the value of attribute submitter_ref.
42 43 44 |
# File 'lib/gedcom/family_record.rb', line 42 def submitter_ref @submitter_ref end |
#wife_ref ⇒ Object
Returns the value of attribute wife_ref.
42 43 44 |
# File 'lib/gedcom/family_record.rb', line 42 def wife_ref @wife_ref end |
Instance Method Details
#annulment(&p) ⇒ Object
Short hand for event('ANUL') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
179 180 181 |
# File 'lib/gedcom/family_record.rb', line 179 def annulment(&p) if block_given? then event('ANUL',&p) else event('ANUL') end end |
#census(&p) ⇒ Object
Short hand for event('CENS') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
200 201 202 |
# File 'lib/gedcom/family_record.rb', line 200 def census(&p) if block_given? then event('CENS',&p) else event('CENS') end end |
#children ⇒ Object
Returns an array of children, or if a block is present, yields them one by one.
101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/gedcom/family_record.rb', line 101 def children if @child_ref != nil children = [] @child_ref.each do |c| if (child = find(c.index, c.xref_value)) != nil yield child if block_given? children << c end end return children if children.length > 0 end return nil end |
#divorce(&p) ⇒ Object
Short hand for event('DIV') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
193 194 195 |
# File 'lib/gedcom/family_record.rb', line 193 def divorce(&p) if block_given? then event('DIV',&p) else event('DIV') end end |
#divorce_filed(&p) ⇒ Object
Short hand for event('DIVF') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
186 187 188 |
# File 'lib/gedcom/family_record.rb', line 186 def divorce_filed(&p) if block_given? then event('DIVF',&p) else event('DIVF') end end |
#engagement(&p) ⇒ Object
Short hand for event('ENGA') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
137 138 139 |
# File 'lib/gedcom/family_record.rb', line 137 def engagement(&p) if block_given? then event('ENGA',&p) else event('ENGA') end end |
#event(type) ⇒ Object
Event looks in the Family_record for events, as specified by the type argument, returning an array of the events found. Returns nil if there were no events of this type in this Family_record.
If a block is given, then yields each event to the block.
120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/gedcom/family_record.rb', line 120 def event(type) if @event_record != nil events = [] @event_record.each do |e| if e.is_event?(type) yield e if block_given? events << e end end return events if events.length > 0 end return nil end |
#husband ⇒ Object
There should only ever be one husband record in a Family_record. If a women has multiple husbands, as some cultures do, then each should be in their own FAM record. The reasoning is that we are recording parentage, not marriages, so we want to be able to uniquely identify which husband is the actual parent (not that we could be that certain in the case of polygamy). The term husband is also used loosely. It refers to the father of children, not necessarily a spouse.
79 80 81 82 83 84 85 |
# File 'lib/gedcom/family_record.rb', line 79 def husband if @husband_ref != nil find(@husband_ref.first.index, @husband_ref.first.xref_value) else nil end end |
#id ⇒ Object
68 69 70 71 |
# File 'lib/gedcom/family_record.rb', line 68 def id #temporary @family_ref end |
#marriage(&p) ⇒ Object
Short hand for event('MARR') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
172 173 174 |
# File 'lib/gedcom/family_record.rb', line 172 def marriage(&p) if block_given? then event('MARR',&p) else event('MARR') end end |
#marriage_bann(&p) ⇒ Object
Short hand for event('MARB') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
144 145 146 |
# File 'lib/gedcom/family_record.rb', line 144 def marriage_bann(&p) if block_given? then event('MARB',&p) else event('MARB') end end |
#marriage_contract(&p) ⇒ Object
Short hand for event('MARC') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
158 159 160 |
# File 'lib/gedcom/family_record.rb', line 158 def marriage_contract(&p) if block_given? then event('MARC',&p) else event('MARC') end end |
#marriage_license(&p) ⇒ Object
Short hand for event('MARL') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
151 152 153 |
# File 'lib/gedcom/family_record.rb', line 151 def marriage_license(&p) if block_given? then event('MARL',&p) else event('MARL') end end |
#marriage_settlement(&p) ⇒ Object
Short hand for event('MARS') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).
165 166 167 |
# File 'lib/gedcom/family_record.rb', line 165 def marriage_settlement(&p) if block_given? then event('MARS',&p) else event('MARS') end end |
#self_check ⇒ Object
Check the xrefs are valid.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/gedcom/family_record.rb', line 205 def self_check if @husband_ref != nil puts "More than one HUSB? in FAM #{@family_ref.first.xref_value}" if @husband_ref.length > 1 #should be just one @husband_ref.each do |h| if (husb = find(h.index, h.xref_value)) == nil puts "Missing INDI record #{h.xref_value} for HUSB in FAM #{@family_ref.first.xref_value}" else puts "Husband's INDI #{h.xref_value} record doesn't have FAMS #{@family_ref.first.xref_value}" if husb.spouse?(self) == false if (sex = husb.sex) != nil sex.each do |s| puts "Husband Female? INDI #{h.xref_value}, FAMS #{@family_ref.first.xref_value}" if s.value.first == 'F' end end end end end if @wife_ref != nil puts "More than one WIFE? in FAM #{@family_ref.first.xref_value}" if @wife_ref.length > 1 #should be just one @wife_ref.each do |w| if (wife = find(w.index, w.xref_value)) == nil puts "Missing INDI record #{w.xref_value} for WIFE in FAM #{@family_ref.first.xref_value}" else puts "Wife's INDI #{w.xref_value} record doesn't have FAMS #{@family_ref.first.xref_value}" if wife.spouse?(self) == false if (sex = wife.sex) != nil sex.each { |s| puts "Wife Male? INDI #{w.xref_value}, FAMS #{@family_ref.first.xref_value}" if s.value.first == 'M' } end end end end if @child_ref != nil #1..many Children @child_ref.each do |c| if (child = find(c.index, c.xref_value)) == nil puts "Missing INDI record for #{c.xref_value} for CHIL in FAM #{@family_ref.first.xref_value}" else puts "Child's INDI #{c.xref_value} record doesn't have FAMC #{@family_ref.first.xref_value}" if child.child?(self) == false end end end if @submitter_ref != nil @submitter_ref.each do |s| puts "Missing SUBM record for #{s.xref_value} in FAM #{@family_ref.first.xref_value}" if find(s.index, s.xref_value) == nil end end end |
#wife ⇒ Object
There should only ever be one wife record in a Family_record. If a man has multiple wives, as some cultures do, then each should be in their own FAM record. The reasoning is that we are recording parentage, not marriages, so we want to be able to uniquely identify which wife is the actual parent. The term wife is used fairly loosely. It refers to the mother of the children, not necessarily a spouse.
92 93 94 95 96 97 98 |
# File 'lib/gedcom/family_record.rb', line 92 def wife if @wife_ref != nil find(@wife_ref.first.index, @wife_ref.first.xref_value) else nil end end |