Class: PLOS::Contributor

Inherits:
Object
  • Object
show all
Includes:
XmlHelpers
Defined in:
lib/plos/contributor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XmlHelpers

#nodes_to_hash, #parse_node, #tag_value

Constructor Details

#initialize(node) ⇒ Contributor

Returns a new instance of Contributor.



10
11
12
13
14
15
16
17
18
19
# File 'lib/plos/contributor.rb', line 10

def initialize(node)
  self.type = node.attr("contrib-type")
  self.name = PLOS::Name.new(node.search("name").first)
  self.role = tag_value(node, "role")
  node.search("xref").each do |xref|
    type = xref.attr("ref-type")
    id = xref.attr("rid")
    self.xrefs << { :type => type, :id => id }
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/plos/contributor.rb', line 5

def name
  @name
end

#roleObject

Returns the value of attribute role.



7
8
9
# File 'lib/plos/contributor.rb', line 7

def role
  @role
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/plos/contributor.rb', line 6

def type
  @type
end

#xrefsObject



21
22
23
# File 'lib/plos/contributor.rb', line 21

def xrefs
  @xrefs ||= []
end