lib/gedcom/family_record.rb
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
#Check the xrefs are valid.
Check the xrefs are valid.
Check the xrefs are valid .
def self_check
    if @husband_ref != nil
      puts "More than one HUSB? in FAM #{@family_ref.first.xref_value}" if @husband_ref.length > 1  
      @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  
      @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
      @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
def self_check if @husband_ref != nil puts "More than one HUSB? in FAM #{@family_ref.first.xref_value}" if @husband_ref . length > 1 @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 @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 @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
Check the xrefs are valid.
Check the xrefs are valid .
#should be just one #should be just one #1..many Children