Class: Jats::Person
Instance Attribute Summary collapse
Attributes inherited from Node
#index, #xml
Instance Method Summary
collapse
Methods inherited from Node
from_xml, index_for, #name, reset_indices, #to_hash, #type
Constructor Details
#initialize(xml) ⇒ Person
Returns a new instance of Person.
5
6
7
8
|
# File 'lib/jats/person.rb', line 5
def initialize(xml)
super(xml)
@affiliations = []
end
|
Instance Attribute Details
#affiliations ⇒ Object
Returns the value of attribute affiliations.
3
4
5
|
# File 'lib/jats/person.rb', line 3
def affiliations
@affiliations
end
|
Instance Method Details
#affiliation_ids ⇒ Object
22
23
24
|
# File 'lib/jats/person.rb', line 22
def affiliation_ids
xml.css('xref[ref-type="aff"]').collect { |r| r['rid'] }
end
|
#attributes ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/jats/person.rb', line 26
def attributes
{
role: role,
given_names: given_names,
last_name: last_name,
affiliations: affiliations.each(&:to_hash)
}
end
|
#given_names ⇒ Object
14
15
16
|
# File 'lib/jats/person.rb', line 14
def given_names
xml.css('given-names').text
end
|
#last_name ⇒ Object
18
19
20
|
# File 'lib/jats/person.rb', line 18
def last_name
xml.css('surname').text
end
|
#role ⇒ Object
10
11
12
|
# File 'lib/jats/person.rb', line 10
def role
xml['contrib-type']
end
|