Class: MML::Name

Inherits:
BaseName show all
Defined in:
lib/mml/common.rb

Instance Attribute Summary collapse

Attributes inherited from BaseName

#repCode, #tableId, #value

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Name

Returns a new instance of Name.



36
37
38
39
40
# File 'lib/mml/common.rb', line 36

def initialize(args = {})
  %W(family given middle fullname prefix degree repCode tableId).each do |item|
    self.send("#{item}=", args[item.to_sym])
  end
end

Instance Attribute Details

#degreeObject

Returns the value of attribute degree.



34
35
36
# File 'lib/mml/common.rb', line 34

def degree
  @degree
end

#familyObject

Returns the value of attribute family.



34
35
36
# File 'lib/mml/common.rb', line 34

def family
  @family
end

#fullnameObject

Returns the value of attribute fullname.



34
35
36
# File 'lib/mml/common.rb', line 34

def fullname
  @fullname
end

#givenObject

Returns the value of attribute given.



34
35
36
# File 'lib/mml/common.rb', line 34

def given
  @given
end

#middleObject

Returns the value of attribute middle.



34
35
36
# File 'lib/mml/common.rb', line 34

def middle
  @middle
end

#prefixObject

Returns the value of attribute prefix.



34
35
36
# File 'lib/mml/common.rb', line 34

def prefix
  @prefix
end

Instance Method Details

#to_xmlObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/mml/common.rb', line 44

def to_xml
  xb = Builder::XmlMarkup.new
  xb.mmlNm(:Name, {'mmlNm:repCode' => @repCode, 'mmlNm:tableId' => @tableId}) do
    xb.mmlNm :family, @family if @family
    xb.mmlNm :middle, @middle if @middle
    xb.mmlNm :given, @given if @given
    xb.mmlNm :fullname, @fullname if @fullname
    xb.mmlNm :prefix, @prefix if @prefix
    xb.mmlNm :degree, @degree if @degree
  end
end