Class: RelatonBib::Person

Inherits:
Contributor show all
Defined in:
lib/relaton_bib/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:



143
144
145
146
147
148
# File 'lib/relaton_bib/person.rb', line 143

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

Instance Attribute Details

#affiliationArray<RelatonBib::Affilation>

Returns:



134
135
136
# File 'lib/relaton_bib/person.rb', line 134

def affiliation
  @affiliation
end

#identifiersArray<RelatonBib::PersonIdentifier>

Returns:



137
138
139
# File 'lib/relaton_bib/person.rb', line 137

def identifiers
  @identifiers
end

#nameRelatonBib::FullName



131
132
133
# File 'lib/relaton_bib/person.rb', line 131

def name
  @name
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


151
152
153
154
155
156
157
158
# File 'lib/relaton_bib/person.rb', line 151

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