lib/iso_bib_item/person.rb in iso-bib-item-0.4.3 vs lib/iso_bib_item/person.rb in iso-bib-item-0.4.4
- old
+ new
@@ -71,10 +71,14 @@
def initialize(type, value)
@type = type
@value = value
end
+
+ def to_xml(builder)
+ builder.identifier value, type: type
+ end
end
# Person class.
class Person < Contributor
# @return [IsoBibItem::FullName]
@@ -86,21 +90,22 @@
# @return [Array<IsoBibItem::PersonIdentifier>]
attr_accessor :identifiers
# @param name [IsoBibItem::FullName]
# @param affiliation [Array<IsoBibItem::Affiliation>]
- def initialize(name:, affiliation: [], contacts:)
+ def initialize(name:, affiliation: [], contacts:, identifiers: [])
super(contacts: contacts)
@name = name
- @affiliation = affiliation
- @identifiers = []
+ @affiliation = affiliation
+ @identifiers = identifiers
end
# @param builder [Nokogiri::XML::Builder]
def to_xml(builder)
builder.person do
name.to_xml builder
affiliation.each { |a| a.to_xml builder }
+ identifiers.each { |id| id.to_xml builder }
contacts.each { |contact| contact.to_xml builder }
end
end
end
end