Class: Name_romanized_record

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

Overview

GEDCOM 5.5.1 Draft adds as subordinate to NAME

+1 ROMN <NAME_ROMANIZED_VARIATION> +2 TYPE <ROMANIZED_TYPE> +2 <<PERSONAL_NAME_PIECES>>

==NAME_ROMANIZED_VARIATION:= Size=1:120 ROMANIZED_TYPE [<user defined> | pinyin | romaji | wadegiles] Size=5:30 The romanized variation of the name is written in the same form prescribed for the name used in the superior <NAME_PERSONAL> context. The method used to romanize the name is indicated by the line_value of the subordinate <ROMANIZED_TYPE>, for example if romaji was used to provide a reading of a name written in kanji, then the ROMANIZED_TYPE subordinate to the ROMN tag would indicate romaji.

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

Returns a new instance of Name_romanized_record.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/gedcom/name_romanized_record.rb', line 25

def initialize(*a)
  super(*a)
  @this_level = [ [:print, "ROMN", :romanized_name] ]
   @sub_level = [
                     [:print, "NPFX",    :prefix ],
                     [:print, "GIVN",    :given ],
                     [:print, "NICK",    :nickname ],
                     [:print, "SPFX",    :surname_prefix ],
                     [:print, "SURN",    :surname ],
                     [:print, "NSFX",    :suffix ],
                     [:walk, nil,    :source_citation_record],
                     [:walk, nil,    :note_citation_record],
                     [:print, "RESN", :restriction],
                 ] 
end

Instance Attribute Details

#givenObject

Returns the value of attribute given.



21
22
23
# File 'lib/gedcom/name_romanized_record.rb', line 21

def given
  @given
end

#nicknameObject

Returns the value of attribute nickname.



21
22
23
# File 'lib/gedcom/name_romanized_record.rb', line 21

def nickname
  @nickname
end

#note_citation_recordObject

Returns the value of attribute note_citation_record.



22
23
24
# File 'lib/gedcom/name_romanized_record.rb', line 22

def note_citation_record
  @note_citation_record
end

#prefixObject

Returns the value of attribute prefix.



21
22
23
# File 'lib/gedcom/name_romanized_record.rb', line 21

def prefix
  @prefix
end

#restrictionObject

Returns the value of attribute restriction.



22
23
24
# File 'lib/gedcom/name_romanized_record.rb', line 22

def restriction
  @restriction
end

#romanized_name=(value) ⇒ Object (writeonly)

romanized Name is stored in romanized_name and recovered via def name, or the alias romanized_name



20
21
22
# File 'lib/gedcom/name_romanized_record.rb', line 20

def romanized_name=(value)
  @romanized_name = value
end

#source_citation_recordObject

Returns the value of attribute source_citation_record.



22
23
24
# File 'lib/gedcom/name_romanized_record.rb', line 22

def source_citation_record
  @source_citation_record
end

#suffixObject

Returns the value of attribute suffix.



21
22
23
# File 'lib/gedcom/name_romanized_record.rb', line 21

def suffix
  @suffix
end

#surnameObject

Returns the value of attribute surname.



21
22
23
# File 'lib/gedcom/name_romanized_record.rb', line 21

def surname
  @surname
end

#surname_prefixObject

Returns the value of attribute surname_prefix.



21
22
23
# File 'lib/gedcom/name_romanized_record.rb', line 21

def surname_prefix
  @surname_prefix
end

Instance Method Details

#nameObject Also known as: romanized_name

return the name as a string. It might be returned be the romanized_name method. or it might need to be contructed from the Name_romanized_record personal name pieces attributes.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/gedcom/name_romanized_record.rb', line 43

def name
  if (name = romanized_name) == nil
    name = "" #could be what we return if none of the Name_record attributes are set
    if @prefix
      name += @prefix.first
      name += ' ' if @given || @nickname || @surname_prefix || @surname || @suffix
    end
    if @given
      name += @given.first  
      name += ' ' if  @nickname || @surname_prefix || @surname || @suffix
    end
    if @nickname
      name += '(' + @nickname.first + ')'  
      name += ' ' if @surname_prefix || @surname || @suffix
    end
    if @surname_prefix
      name += @surname_prefix.first
      name += ' ' if  @surname || @suffix
    end
    if @surname
      name += ( '/' + @surname.first + '/' ) 
      name += ' ' if  @suffix
    end
    name += @suffix.first  if @suffix
  end
  return name.first
end