Class: Transmission

Inherits:
TransmissionBase show all
Defined in:
lib/gedcom/transmission.rb

Constant Summary

Constants inherited from TransmissionBase

TransmissionBase::ACTION, TransmissionBase::DATA

Instance Attribute Summary collapse

Attributes inherited from TransmissionBase

#class_stack, #indexes

Attributes inherited from GEDCOMBase

#restriction

Instance Method Summary collapse

Methods inherited from TransmissionBase

#action_handler, #add_to_class_field, #add_to_index, #append_nl_field, #append_sp_field, #append_to_field, #create_class, #create_index, #define, #defined, #pop, #summary, #update_field, #validate

Methods inherited from GEDCOMBase

#changed, #changed?, #created?, #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) ⇒ Transmission

Returns a new instance of Transmission.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/gedcom/transmission.rb', line 38

def initialize(*a)
  super(nil, *a[1..-1]) #don't need to put ourselves into @transmission.
  
  @this_level = [ [:walk, nil, :header_record],     #Recurse over the HEAD header records (should only be one)
                  [:walk, nil, :submission_record], #Recurse over the SUBN submission records
                  [:walk, nil, :submitter_record],  #Recurse over the SUBM submitter record(s)
                  [:walk, nil, :source_record],     #Recurse over the SOUR Source records
                  [:walk, nil, :repository_record], #Recurse over the REPO repository records
                  [:walk, nil, :family_record],     #Recurse over the FAM Family records
                  [:walk, nil, :individual_record], #Recurse over the INDI Individual records
                  [:walk, nil, :multimedia_record], #Recurse over the OBJE multimedia records
                  [:walk, nil, :note_record],       #Recurse over the NOTE records
                  [:walk, nil, :trailer_record],    #Recurse over the Trailer Record(s). (should only be the one).
                ]
  @sub_level =  [#level + 1
                ]

end

Instance Attribute Details

#family_recordObject

Returns the value of attribute family_record.



35
36
37
# File 'lib/gedcom/transmission.rb', line 35

def family_record
  @family_record
end

#header_recordObject

Returns the value of attribute header_record.



35
36
37
# File 'lib/gedcom/transmission.rb', line 35

def header_record
  @header_record
end

#individual_recordObject

Returns the value of attribute individual_record.



35
36
37
# File 'lib/gedcom/transmission.rb', line 35

def individual_record
  @individual_record
end

#multimedia_recordObject

Returns the value of attribute multimedia_record.



36
37
38
# File 'lib/gedcom/transmission.rb', line 36

def multimedia_record
  @multimedia_record
end

#note_recordObject

Returns the value of attribute note_record.



36
37
38
# File 'lib/gedcom/transmission.rb', line 36

def note_record
  @note_record
end

#repository_recordObject

Returns the value of attribute repository_record.



36
37
38
# File 'lib/gedcom/transmission.rb', line 36

def repository_record
  @repository_record
end

#source_recordObject

Returns the value of attribute source_record.



35
36
37
# File 'lib/gedcom/transmission.rb', line 35

def source_record
  @source_record
end

#submission_recordObject

Returns the value of attribute submission_record.



36
37
38
# File 'lib/gedcom/transmission.rb', line 36

def submission_record
  @submission_record
end

#submitter_recordObject

Returns the value of attribute submitter_record.



35
36
37
# File 'lib/gedcom/transmission.rb', line 35

def submitter_record
  @submitter_record
end

#trailer_recordObject

Returns the value of attribute trailer_record.



36
37
38
# File 'lib/gedcom/transmission.rb', line 36

def trailer_record
  @trailer_record
end

Instance Method Details

#dump_indexesObject

debugging code to show what indexes were created and what keys are in each Printing out the index values generates too much output, so these are ignored.



83
84
85
86
87
88
89
90
# File 'lib/gedcom/transmission.rb', line 83

def dump_indexes
  @indexes.each do |key,value|
    puts "Index #{key}"
    value.each do |vkey, vvalue|
      puts "\t#{vkey}"
    end
  end
end

#find(index_name, key) ⇒ Object

Looks in a transmissions indexes for an index called index_name, returning the value associated with the key. also used by xref_check to validate the XREF entries in a transmission really do point to valid level 0 records. Standard indexes are the same as the level 0 types that have XREF values: * :individual * :family * :note * :source * :repository * :multimedia * :submitter * :submission Keys in each of these indexes are the XREF values from the GEDCOM file. The values stored in the indexes are the actual objects that they refer to. * e.g. if (f = find(:individual,“I14”) ) != nil then print f.to_gedcom end will find the Individual's record with “0 @I14@ INDI” and print the record and its sub-records.



73
74
75
76
77
78
79
# File 'lib/gedcom/transmission.rb', line 73

def find(index_name, key)
  if @indexes != nil && (index = @indexes[index_name.to_sym]) != nil
    index[key]
  else
    nil
  end
end

#self_checkObject



92
93
94
95
96
97
98
99
# File 'lib/gedcom/transmission.rb', line 92

def self_check
  @family_record.each do |f|
    f.self_check
  end
  @individual_record.each do |i|
    i.self_check
  end
end