Sha256: 7c3e6091f747afeca0d6fd986536314e970c37cc58ac013c2e2f740eaaec74f5

Contents?: true

Size: 565 Bytes

Versions: 28

Compression:

Stored size: 565 Bytes

Contents

module SsciInc
  class PersonName

    attr_accessor :given_name,
                  :middle_name,
                  :family_name,
                  :affix

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

    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

    def to_xml
      as_xml.to_xml
    end

  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ssci_inc-0.1.7 lib/ssci_inc/person_name.rb
ssci_inc-0.1.6 lib/ssci_inc/person_name.rb
ssci_inc-0.1.5 lib/ssci_inc/person_name.rb
ssci_inc-0.1.4 lib/ssci_inc/person_name.rb
ssci_inc-0.1.3 lib/ssci_inc/person_name.rb
ssci_inc-0.1.2 lib/ssci_inc/person_name.rb
ssci_inc-0.1.1 lib/ssci_inc/person_name.rb
ssci_inc-0.1.0 lib/ssci_inc/person_name.rb