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:) ⇒ Person

Returns a new instance of Person.

Parameters:



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

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

Instance Attribute Details

#affiliationArray<IsoBibItem::Affilation>



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

def affiliation
  @affiliation
end

#identifiersArray<IsoBibItem::PersonIdentifier>



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

def identifiers
  @identifiers
end

#nameIsoBibItem::FullName



81
82
83
# File 'lib/iso_bib_item/person.rb', line 81

def name
  @name
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


99
100
101
102
103
104
105
# File 'lib/iso_bib_item/person.rb', line 99

def to_xml(builder)
  builder.person do
    name.to_xml builder
    affiliation.each { |a| a.to_xml builder }
    contacts.each { |contact| contact.to_xml builder }
  end
end