Class: Individual_record

Inherits:
GEDCOMBase show all
Defined in:
lib/gedcom/individual_record.rb

Overview

Internal representation of the GEDCOM level 0 INDI record type

=INDIVIDUAL_RECORD:= n @XREF:INDI@ INDI 1:1 +1 RESN <RESTRICTION_NOTICE> 0:1 +1 <<PERSONAL_NAME_STRUCTURE>> 0:M +1 <<INDIVIDUAL_EVENT_STRUCTURE>> 0:M +1 <<INDIVIDUAL_ATTRIBUTE_STRUCTURE>> 0:M +1 <<LDS_INDIVIDUAL_ORDINANCE>> 0:M +1 <<CHILD_TO_FAMILY_LINK>> 0:M +1 <<SPOUSE_TO_FAMILY_LINK>> 0:M +1 SUBM @<XREF:SUBM>@ 0:M +1 <<ASSOCIATION_STRUCTURE>> 0:M +1 ALIA @<XREF:INDI>@ 0:M +1 ANCI @<XREF:SUBM>@ 0:M +1 DESI @<XREF:SUBM>@ 0:M +1 <<SOURCE_CITATION>> 0:M +1 <<MULTIMEDIA_LINK>> 0:M +1 <<NOTE_STRUCTURE>> 0:M +1 RFN <PERMANENT_RECORD_FILE_NUMBER> 0:1 +1 AFN <ANCESTRAL_FILE_NUMBER> 0:1 +1 REFN <USER_REFERENCE_NUMBER> 0:M +2 TYPE <USER_REFERENCE_TYPE> 0:1 +1 RIN <AUTOMATED_RECORD_ID> 0:1 +1 <<CHANGE_DATE>> 0:1

The individual record is a compilation of facts, known or discovered, about an individual. Sometimes these facts are from different sources. This form allows documentation of the source where each of the facts were discovered.

The normal lineage links are shown through the use of pointers from the individual to a family through either the FAMC tag or the FAMS tag. The FAMC tag provides a pointer to a family where this person is a child. The FAMS tag provides a pointer to a family where this person is a spouse or parent. The <<CHILD_TO_FAMILY_LINK>> (see page 27) structure contains a FAMC pointer which is required to show any child to parent linkage for pedigree navigation. The <<CHILD_TO_FAMILY_LINK>> structure also indicates whether the pedigree link represents a birth lineage, an adoption lineage, or a sealing lineage.

Linkage between a child and the family they belonged to at the time of an event can also optionally be shown by a FAMC pointer subordinate to the appropriate event. For example, a FAMC pointer subordinate to an adoption event would show which family adopted this individual. Biological parent or parents can be indicated by a FAMC pointer subordinate to the birth event. The FAMC tag can also optionally be used subordinate to an ADOPtion, or BIRTh event to differentiate which set of parents were related by adoption, sealing, or birth.

I removed SEX from INDI and added it to the Individual_attribute_record class.

Other associations or relationships are represented by the ASSOciation tag. The person's relation or association is the person being pointed to. The association or relationship is stated by the value on the subordinate RELA line. For example: 0 @I1@ INDI 1 NAME Fred/Jones/ 1 ASSO @I2@ 2 RELA Godfather

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

Instance Method Summary collapse

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) ⇒ Individual_record

new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/gedcom/individual_record.rb', line 71

def initialize(*a)
  super(*a)
  @this_level = [ [:xref, "INDI", :individual_ref] ]
  @sub_level =  [ #level 1
                  [:print, "RESN", :restriction],
                  [:walk, nil,  :name_record],
                  [:walk, nil, :individual_attribute_record],
                  [:walk, nil, :event_record],
                  [:walk, nil, :families_individuals],
                  [:walk, nil, :association_record],
                  [:xref, "ALIA", :alias_ref],
                  [:xref, "ANCI", :ancestor_interest_ref],
                  [:xref, "DESI", :descendant_interest_ref],
                  [:xref, "SUBM", :submitter_ref],
                  [:walk, nil,    :multimedia_citation_record ],
                  [:walk, nil,    :source_citation_record ],
                  [:walk, nil,    :note_citation_record ],
                  [:print, "RFN", :registered_ref_id],
                  [:print, "AFN", :lds_ancestral_file_no],
                  [:walk, nil, :refn_record ],
                  [:walk, nil,    :change_date_record],
                  [:print, "RIN",  :automated_record_id ],
                ]
end

Instance Attribute Details

#alias_refObject

Returns the value of attribute alias_ref.



63
64
65
# File 'lib/gedcom/individual_record.rb', line 63

def alias_ref
  @alias_ref
end

#ancestor_interest_refObject

Returns the value of attribute ancestor_interest_ref.



64
65
66
# File 'lib/gedcom/individual_record.rb', line 64

def ancestor_interest_ref
  @ancestor_interest_ref
end

#association_recordObject

Returns the value of attribute association_record.



64
65
66
# File 'lib/gedcom/individual_record.rb', line 64

def association_record
  @association_record
end

#automated_record_idObject

Returns the value of attribute automated_record_id.



66
67
68
# File 'lib/gedcom/individual_record.rb', line 66

def automated_record_id
  @automated_record_id
end

#change_date_recordObject

Returns the value of attribute change_date_record.



66
67
68
# File 'lib/gedcom/individual_record.rb', line 66

def change_date_record
  @change_date_record
end

#descendant_interest_refObject

Returns the value of attribute descendant_interest_ref.



64
65
66
# File 'lib/gedcom/individual_record.rb', line 64

def descendant_interest_ref
  @descendant_interest_ref
end

#event_recordObject

Returns the value of attribute event_record.



63
64
65
# File 'lib/gedcom/individual_record.rb', line 63

def event_record
  @event_record
end

#families_individualsObject

Returns the value of attribute families_individuals.



64
65
66
# File 'lib/gedcom/individual_record.rb', line 64

def families_individuals
  @families_individuals
end

#individual_attribute_recordObject

Returns the value of attribute individual_attribute_record.



63
64
65
# File 'lib/gedcom/individual_record.rb', line 63

def individual_attribute_record
  @individual_attribute_record
end

#individual_refObject

Returns the value of attribute individual_ref.



63
64
65
# File 'lib/gedcom/individual_record.rb', line 63

def individual_ref
  @individual_ref
end

#lds_ancestral_file_noObject

Returns the value of attribute lds_ancestral_file_no.



66
67
68
# File 'lib/gedcom/individual_record.rb', line 66

def lds_ancestral_file_no
  @lds_ancestral_file_no
end

#multimedia_citation_recordObject

Returns the value of attribute multimedia_citation_record.



65
66
67
# File 'lib/gedcom/individual_record.rb', line 65

def multimedia_citation_record
  @multimedia_citation_record
end

#name_recordObject

Returns the value of attribute name_record.



63
64
65
# File 'lib/gedcom/individual_record.rb', line 63

def name_record
  @name_record
end

#note_citation_recordObject

Returns the value of attribute note_citation_record.



65
66
67
# File 'lib/gedcom/individual_record.rb', line 65

def note_citation_record
  @note_citation_record
end

#refn_recordObject

Returns the value of attribute refn_record.



66
67
68
# File 'lib/gedcom/individual_record.rb', line 66

def refn_record
  @refn_record
end

#registered_ref_idObject

Returns the value of attribute registered_ref_id.



66
67
68
# File 'lib/gedcom/individual_record.rb', line 66

def registered_ref_id
  @registered_ref_id
end

#restrictionObject

Returns the value of attribute restriction.



63
64
65
# File 'lib/gedcom/individual_record.rb', line 63

def restriction
  @restriction
end

#source_citation_recordObject

Returns the value of attribute source_citation_record.



65
66
67
# File 'lib/gedcom/individual_record.rb', line 65

def source_citation_record
  @source_citation_record
end

#submitter_refObject

Returns the value of attribute submitter_ref.



64
65
66
# File 'lib/gedcom/individual_record.rb', line 64

def submitter_ref
  @submitter_ref
end

Instance Method Details

#adoption(&p) ⇒ Object

Short hand for event('ADOP') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



202
203
204
# File 'lib/gedcom/individual_record.rb', line 202

def adoption(&p)
  if block_given? then event('ADOP',&p) else event('ADOP') end
end

#adult_christening(&p) ⇒ Object

Short hand for event('CHRA') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



300
301
302
# File 'lib/gedcom/individual_record.rb', line 300

def adult_christening(&p)
  if block_given? then event('CHRA',&p) else event('CHRA') end
end

#attribute(attribute) ⇒ Object

Attribute looks in the Individual_record for attributes, as specified by the attribute argument, returning an array of the attrbutes found. This may be a 0 length array, if there were no attrbutes of this type in this Individual_record.

If a block is given, then yields each event to the block.



379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/gedcom/individual_record.rb', line 379

def attribute(attribute)
  if @individual_attribute_record != nil
    attributes = [] #collect the individual_attribute_record's of type attribute in this array.
    @individual_attribute_record.each do |a| 
      #Look for the attribute in question.
      if a.is_attribute?(attribute)
        yield a if block_given? 
        attributes << a #add this record to the attributes array.
      end
    end
    return attributes if attributes.length > 0 #if we found any, return the array.
  end
  return nil #if we found none, then return nil.
end

#baptism(&p) ⇒ Object

Short hand for event('BAPM') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



265
266
267
# File 'lib/gedcom/individual_record.rb', line 265

def baptism(&p)
  if block_given? then event('BAPM',&p) else event('BAPM') end
end

#bar_mitzvah(&p) ⇒ Object

Short hand for event('BARM') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



272
273
274
# File 'lib/gedcom/individual_record.rb', line 272

def bar_mitzvah(&p)
  if block_given? then event('BARM',&p) else event('BARM') end
end

#bas_mitzvah(&p) ⇒ Object

Short hand for event('BASM') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



279
280
281
# File 'lib/gedcom/individual_record.rb', line 279

def bas_mitzvah(&p)
  if block_given? then event('BASM',&p) else event('BASM') end
end

#birth(&p) ⇒ Object

Short hand for event('BIRT') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



188
189
190
# File 'lib/gedcom/individual_record.rb', line 188

def birth(&p)
  if block_given? then event('BIRT',&p) else event('BIRT') end
end

#blessing(&p) ⇒ Object

Short hand for event('BLES') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



286
287
288
# File 'lib/gedcom/individual_record.rb', line 286

def blessing(&p)
  if block_given? then event('BLES',&p) else event('BLES') end
end

#burial(&p) ⇒ Object

Short hand for event('BURI') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



216
217
218
# File 'lib/gedcom/individual_record.rb', line 216

def burial(&p)
  if block_given? then event('BURI',&p) else event('BURI') end
end

#caste_name(&p) ⇒ Object

Short hand for attribute('CAST') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



404
405
406
# File 'lib/gedcom/individual_record.rb', line 404

def caste_name(&p)
  if block_given? then attribute('CAST',&p) else attribute('CAST') 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).



244
245
246
# File 'lib/gedcom/individual_record.rb', line 244

def census(&p)
  if block_given? then event('CENS',&p) else event('CENS') end
end

#child?(fam) ⇒ Boolean

child? is a consistency check, testing that this INDI record has a FAMC record to the given FAM record.

Returns:

  • (Boolean)


125
126
127
128
129
130
131
132
# File 'lib/gedcom/individual_record.rb', line 125

def child?(fam)
  if (pf = parents_family) != nil
    pf.each do |famc|
      return true if famc == fam
    end
  end
  return false
end

#christening(&p) ⇒ Object

Short hand for event('CHR') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



195
196
197
# File 'lib/gedcom/individual_record.rb', line 195

def christening(&p)
  if block_given? then event('CHR',&p) else event('CHR') end
end

#confirmation(&p) ⇒ Object

Short hand for event('CONF') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



307
308
309
# File 'lib/gedcom/individual_record.rb', line 307

def confirmation(&p)
  if block_given? then event('CONF',&p) else event('CONF') end
end

#cremation(&p) ⇒ Object

Short hand for event('CREM') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



223
224
225
# File 'lib/gedcom/individual_record.rb', line 223

def cremation(&p)
  if block_given? then event('CREM',&p) else event('CREM') end
end

#death(&p) ⇒ Object

Short hand for event('DEAT') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



209
210
211
# File 'lib/gedcom/individual_record.rb', line 209

def death(&p)
  if block_given? then event('DEAT',&p) else event('DEAT') end
end

#education(&p) ⇒ Object

Short hand for attribute('EDUC') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



418
419
420
# File 'lib/gedcom/individual_record.rb', line 418

def education(&p)
  if block_given? then attribute('EDUC',&p) else attribute('EDUC') end
end

#emigration(&p) ⇒ Object

Short hand for event('EMIG') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



328
329
330
# File 'lib/gedcom/individual_record.rb', line 328

def emigration(&p)
  if block_given? then event('EMIG',&p) else event('EMIG') end
end

#event(type) ⇒ Object

Event looks in the Individual_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 Individual_record.

If a block is given, then yields each event to the block.



171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/gedcom/individual_record.rb', line 171

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

#first_communion(&p) ⇒ Object

Short hand for event('FCOM') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



314
315
316
# File 'lib/gedcom/individual_record.rb', line 314

def first_communion(&p)
  if block_given? then event('FCOM',&p) else event('FCOM') end
end

#graduation(&p) ⇒ Object

Short hand for event('GRAD') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



251
252
253
# File 'lib/gedcom/individual_record.rb', line 251

def graduation(&p)
  if block_given? then event('GRAD',&p) else event('GRAD') end
end

#has_name?Boolean

Test to see if we have a NAME record stored for this individual.

Returns:

  • (Boolean)


493
494
495
# File 'lib/gedcom/individual_record.rb', line 493

def has_name?
  @name_record != nil && @name_record.length > 0
end

#idObject



96
97
98
99
# File 'lib/gedcom/individual_record.rb', line 96

def id
  #temporary 
  @individual_ref
end

#immigration(&p) ⇒ Object

Short hand for event('IMMI') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



335
336
337
# File 'lib/gedcom/individual_record.rb', line 335

def immigration(&p)
  if block_given? then event('IMMI',&p) else event('IMMI') end
end

#lds_baptism(&p) ⇒ Object

Short hand for the event('BAPL') LDS Ordinance passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



342
343
344
# File 'lib/gedcom/individual_record.rb', line 342

def lds_baptism(&p)
  if block_given? then event('BAPL',&p) else event('BAPL') end
end

#lds_child_sealing(&p) ⇒ Object

Short hand for the event('SLGC') LDS Ordinance passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



363
364
365
# File 'lib/gedcom/individual_record.rb', line 363

def lds_child_sealing(&p)
  if block_given? then event('SLGC',&p) else event('SLGC') end
end

#lds_confirmation(&p) ⇒ Object

Short hand for the event('CONL') LDS Ordinance passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



349
350
351
# File 'lib/gedcom/individual_record.rb', line 349

def lds_confirmation(&p)
  if block_given? then event('CONL',&p) else event('CONL') end
end

#lds_endowment(&p) ⇒ Object

Short hand for the event('ENDL') LDS Ordinance passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



356
357
358
# File 'lib/gedcom/individual_record.rb', line 356

def lds_endowment(&p)
  if block_given? then event('ENDL',&p) else event('ENDL') end
end

#lds_spouse_sealing(&p) ⇒ Object

Short hand for the event('SLGS') LDS Sealing passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



370
371
372
# File 'lib/gedcom/individual_record.rb', line 370

def lds_spouse_sealing(&p)
  if block_given? then event('SLGS',&p) else event('SLGS') end
end

#marriage_count(&p) ⇒ Object

Short hand for attribute('NMR') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



446
447
448
# File 'lib/gedcom/individual_record.rb', line 446

def marriage_count(&p)
  if block_given? then attribute('NMR',&p) else attribute('NMR') end
end

#namesObject

Names looks in the Individual_record for Name_records, returning an array of the Name_records found. This may be a 0 length array, if there were no NAME tags in this GEDCOM record for this Individual_record.

If a block is given, then yields each event to the block.



501
502
503
504
505
506
507
508
509
510
# File 'lib/gedcom/individual_record.rb', line 501

def names
  if has_name?
    if block_given?
      @name_record.each { |n| yield n }
    end
    return @name_record
  else
    return []
  end
end

#national_id_number(&p) ⇒ Object

Short hand for attribute('IDNO') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



425
426
427
# File 'lib/gedcom/individual_record.rb', line 425

def national_id_number(&p)
  if block_given? then attribute('IDNO',&p) else attribute('IDNO') end
end

#national_origin(&p) ⇒ Object

Short hand for attribute('NATI') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



432
433
434
# File 'lib/gedcom/individual_record.rb', line 432

def national_origin(&p)
  if block_given? then attribute('NATI',&p) else attribute('NATI') end
end

#naturalization(&p) ⇒ Object

Short hand for event('NATU') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



321
322
323
# File 'lib/gedcom/individual_record.rb', line 321

def naturalization(&p)
  if block_given? then event('NATU',&p) else event('NATU') end
end

#number_children(&p) ⇒ Object

Short hand for attribute('NCHI') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



439
440
441
# File 'lib/gedcom/individual_record.rb', line 439

def number_children(&p)
  if block_given? then attribute('NCHI',&p) else attribute('NCHI') end
end

#occupation(&p) ⇒ Object

Short hand for attribute('OCCU') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



453
454
455
# File 'lib/gedcom/individual_record.rb', line 453

def occupation(&p)
  if block_given? then attribute('OCCU',&p) else attribute('OCCU') end
end

#ordination(&p) ⇒ Object

Short hand for event('ORDN') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



293
294
295
# File 'lib/gedcom/individual_record.rb', line 293

def ordination(&p)
  if block_given? then event('ORDN',&p) else event('ORDN') end
end

#parents_familyObject

Finds the parent's family record(s) and returns the Family_record object in an array. This allows for multiple parentage. There is usually only be one FAMC record, but their might be another recording an adoption or an alternate family, if parentage is not clear. Parents_family returns nil if there are no FAMC records (or the FAMC XREFs don't resolve to a FAM record in the transmission).

If a block is passed, then each Family_record is yielded to the block.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/gedcom/individual_record.rb', line 108

def parents_family
  if @families_individuals
    parent_families = []
    @families_individuals.each do |p| 
      if p.relationship_type[0] == "FAMC"
        if (parent_family = find(:family, p.parents_family_ref.first.xref_value)) != nil
          parent_families << parent_family
          yield parent_family if block_given?
        end
      end
    end
    return parent_families if parent_families.length > 0 #might be a 0 length array.
  end
  return nil
end

#physical_description(&p) ⇒ Object

Short hand for attribute('DSCR') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



411
412
413
# File 'lib/gedcom/individual_record.rb', line 411

def physical_description(&p)
  if block_given? then attribute('DSCR',&p) else attribute('DSCR') end
end

#possessions(&p) ⇒ Object

Short hand for attribute('PROP') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



460
461
462
# File 'lib/gedcom/individual_record.rb', line 460

def possessions(&p)
  if block_given? then attribute('PROP',&p) else attribute('PROP') end
end

#primary_nameObject

Primary_name returns the first name (as a string) defined in the @name_record array (and probably the only name defined). The GEDCOM standard states that if multiple TAGS of the same type are present, then the first is the most preferred, with the last the least preferred. I'm not certain that programs generating GEDCOM follow that rule, but if there are multiple NAME records, and you want one to display, then picking the first is what the standard says to do.

Returns “” if no name is recorded in this Individual_record and if the individual requested privacy for this record.



519
520
521
522
523
524
525
526
527
528
529
# File 'lib/gedcom/individual_record.rb', line 519

def primary_name
  if has_name? 
    if  self.private? || @name_record[0].private?
      ""
    else
       @name_record[0].name 
    end 
  else 
    "" 
  end
end

#probate(&p) ⇒ Object

Short hand for event('PROB') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



237
238
239
# File 'lib/gedcom/individual_record.rb', line 237

def probate(&p)
  if block_given? then event('PROB',&p) else event('PROB') end
end

#religion(&p) ⇒ Object

Short hand for attribute('RELI') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



467
468
469
# File 'lib/gedcom/individual_record.rb', line 467

def religion(&p)
  if block_given? then attribute('RELI',&p) else attribute('RELI') end
end

#residence(&p) ⇒ Object

Short hand for attribute('RESI') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



474
475
476
# File 'lib/gedcom/individual_record.rb', line 474

def residence(&p)
  if block_given? then attribute('RESI',&p) else attribute('RESI') end
end

#retirement(&p) ⇒ Object

Short hand for event('RETI') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



258
259
260
# File 'lib/gedcom/individual_record.rb', line 258

def retirement(&p)
  if block_given? then event('RETI',&p) else event('RETI') end
end

#self_checkObject



531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/gedcom/individual_record.rb', line 531

def self_check
  if @families_individuals
    @families_individuals.each do |p| 
      if p.relationship_type[0] == "FAMC"
        if find(:family, p.parents_family_ref.first.xref_value) == nil
          puts "INDI #{@individual_ref.first.xref_value} FAMC #{p.parents_family_ref.first.xref_value} record has no FAM record"
        end
      elsif p.relationship_type[0] == "FAMS"
        if find(:family, p.family_ref.first.xref_value) == nil
          puts "INDI #{@individual_ref.first.xref_value} FAMS #{p.family_ref.first.xref_value} record has no FAM record"
        end
      else
        puts "Unrecognised relationship #{p.relationship_type[0]}"
      end
    end
  else
    puts "INDI #{@individual_ref.first.xref_value} has no FAMC or FAMS record"
  end
end

#sex(&p) ⇒ Object

Short hand for attribute('SEX') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



397
398
399
# File 'lib/gedcom/individual_record.rb', line 397

def sex(&p)
  if block_given? then attribute('SEX',&p) else attribute('SEX') end
end

#social_security_number(&p) ⇒ Object

Short hand for attribute('SSN') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



481
482
483
# File 'lib/gedcom/individual_record.rb', line 481

def social_security_number(&p)
  if block_given? then attribute('SSN',&p) else attribute('SSN') end
end

#spouse?(fam) ⇒ Boolean

spouse? is a consistency check, testing that this INDI record has a FAMS record to the given FAM record.

Returns:

  • (Boolean)


157
158
159
160
161
162
163
164
# File 'lib/gedcom/individual_record.rb', line 157

def spouse?(fam)
  if (pf = spouses) != nil
    pf.each do |fams|
      return true if fams == fam
    end
  end
  return false
end

#spousesObject

Finds the family record for each spouse (or fellow parent) and returns the Family_record objects in an array. This allows for being a parent of multiple families. Spouses will return nil if there are no FAMS records (or the FAMS XREFs don't resolve to a FAM record in the transmission).

If a block is passed, then each Family_record is yielded to the block.



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/gedcom/individual_record.rb', line 139

def spouses
  if @families_individuals
    spouses = []
    @families_individuals.each do |s|
      if s.relationship_type[0] == "FAMS"
        #Make sure we can find the spouse's Family_record.
        if (spouse_family = find(:family, s.family_ref.first.xref_value)) != nil
          spouses << spouse_family
          yield spouse_family if block_given?
        end
      end
    end
    return spouses if spouses.length > 0 #might be a 0 length array.
  end
  return nil
end

#title(&p) ⇒ Object

Short hand for attribute('TITL') passes on any block to the event method (The block is the &p argument, so you don't pass any arguments to this method).



488
489
490
# File 'lib/gedcom/individual_record.rb', line 488

def title(&p)
  if block_given? then attribute('TITL',&p) else attribute('TITL') end
end

#will(&p) ⇒ Object

Short hand for event('WILL') passes on any block to the event method. (The block is the &p argument, so you don't pass any arguments to this method).



230
231
232
# File 'lib/gedcom/individual_record.rb', line 230

def will(&p)
  if block_given? then event('WILL',&p) else event('WILL') end
end