Class: SsciInc::PersonName

Inherits:
Object
  • Object
show all
Defined in:
lib/ssci_inc/person_name.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h = {}) ⇒ PersonName

Returns a new instance of PersonName.



9
10
11
# File 'lib/ssci_inc/person_name.rb', line 9

def initialize(h={})
  h.each {|k,v| send("#{k}=", v) if respond_to?("#{k}=") }
end

Instance Attribute Details

#affixObject

Returns the value of attribute affix.



4
5
6
# File 'lib/ssci_inc/person_name.rb', line 4

def affix
  @affix
end

#family_nameObject

Returns the value of attribute family_name.



4
5
6
# File 'lib/ssci_inc/person_name.rb', line 4

def family_name
  @family_name
end

#given_nameObject

Returns the value of attribute given_name.



4
5
6
# File 'lib/ssci_inc/person_name.rb', line 4

def given_name
  @given_name
end

#middle_nameObject

Returns the value of attribute middle_name.



4
5
6
# File 'lib/ssci_inc/person_name.rb', line 4

def middle_name
  @middle_name
end

Instance Method Details

#as_xmlObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/ssci_inc/person_name.rb', line 13

def as_xml
  Nokogiri::XML::Builder.new do |xml|
    xml.PersonName {
      xml.GivenName given_name
      xml.MiddleName middle_name
      xml.FamilyName family_name
      xml.Affix affix
    }
  end.parent.root
end

#to_xmlObject



24
25
26
# File 'lib/ssci_inc/person_name.rb', line 24

def to_xml
  as_xml.to_xml
end