Class: IsoBibItem::Person

Inherits:
Contributor show all
Defined in:
lib/iso_bib_item/person.rb

Overview

Person class.

Instance Attribute Summary collapse

Attributes inherited from Contributor

#contacts, #uri

Instance Method Summary collapse

Methods inherited from Contributor

#url

Constructor Details

#initialize(name:, affiliation: [], contacts:, identifiers: []) ⇒ Person

Returns a new instance of Person.

Parameters:



95
96
97
98
99
100
# File 'lib/iso_bib_item/person.rb', line 95

def initialize(name:, affiliation: [], contacts:, identifiers: [])
  super(contacts: contacts)
  @name        = name
  @affiliation = affiliation
  @identifiers = identifiers
end

Instance Attribute Details

#affiliationArray<IsoBibItem::Affilation>



88
89
90
# File 'lib/iso_bib_item/person.rb', line 88

def affiliation
  @affiliation
end

#identifiersArray<IsoBibItem::PersonIdentifier>



91
92
93
# File 'lib/iso_bib_item/person.rb', line 91

def identifiers
  @identifiers
end

#nameIsoBibItem::FullName



85
86
87
# File 'lib/iso_bib_item/person.rb', line 85

def name
  @name
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


103
104
105
106
107
108
109
110
# File 'lib/iso_bib_item/person.rb', line 103

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