Class: PLOS::Contributor
- Inherits:
-
Object
- Object
- PLOS::Contributor
- Includes:
- XmlHelpers
- Defined in:
- lib/plos/contributor.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#role ⇒ Object
Returns the value of attribute role.
-
#type ⇒ Object
Returns the value of attribute type.
- #xrefs ⇒ Object
Instance Method Summary collapse
-
#initialize(node) ⇒ Contributor
constructor
A new instance of Contributor.
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
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/plos/contributor.rb', line 5 def name @name end |
#role ⇒ Object
Returns the value of attribute role.
7 8 9 |
# File 'lib/plos/contributor.rb', line 7 def role @role end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/plos/contributor.rb', line 6 def type @type end |
#xrefs ⇒ Object
21 22 23 |
# File 'lib/plos/contributor.rb', line 21 def xrefs @xrefs ||= [] end |