Class: PLOS::Reference
- Inherits:
-
Object
- Object
- PLOS::Reference
- Includes:
- XmlHelpers
- Defined in:
- lib/plos/reference.rb
Instance Attribute Summary collapse
- #authors ⇒ Object
-
#first_page ⇒ Object
Returns the value of attribute first_page.
-
#id ⇒ Object
Returns the value of attribute id.
-
#label ⇒ Object
Returns the value of attribute label.
-
#last_page ⇒ Object
Returns the value of attribute last_page.
-
#source ⇒ Object
Returns the value of attribute source.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
-
#volume ⇒ Object
Returns the value of attribute volume.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(node) ⇒ Reference
constructor
A new instance of Reference.
Methods included from XmlHelpers
#nodes_to_hash, #parse_node, #tag_value
Constructor Details
#initialize(node) ⇒ Reference
Returns a new instance of Reference.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/plos/reference.rb', line 16 def initialize(node) self.id = node.attr("id") if node.attr("id") self.label = tag_value(node, "label") citation_node = node.search("element-citation") if citation_node self.type = citation_node.attr("publication-type").value if citation_node.attr("publication-type") self.year = tag_value(citation_node, "year") self.title = tag_value(citation_node, "article-title") self.source = tag_value(citation_node, "source") self.volume = tag_value(citation_node, "volume") self.first_page = tag_value(citation_node, "fpage") self.last_page = tag_value(citation_node, "lpage") citation_node.search("name").each do |name_node| self. << PLOS::Name.new(name_node) end end end |
Instance Attribute Details
#authors ⇒ Object
34 35 36 |
# File 'lib/plos/reference.rb', line 34 def @authors ||= [] end |
#first_page ⇒ Object
Returns the value of attribute first_page.
12 13 14 |
# File 'lib/plos/reference.rb', line 12 def first_page @first_page end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/plos/reference.rb', line 5 def id @id end |
#label ⇒ Object
Returns the value of attribute label.
6 7 8 |
# File 'lib/plos/reference.rb', line 6 def label @label end |
#last_page ⇒ Object
Returns the value of attribute last_page.
13 14 15 |
# File 'lib/plos/reference.rb', line 13 def last_page @last_page end |
#source ⇒ Object
Returns the value of attribute source.
10 11 12 |
# File 'lib/plos/reference.rb', line 10 def source @source end |
#title ⇒ Object
Returns the value of attribute title.
9 10 11 |
# File 'lib/plos/reference.rb', line 9 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/plos/reference.rb', line 8 def type @type end |
#volume ⇒ Object
Returns the value of attribute volume.
11 12 13 |
# File 'lib/plos/reference.rb', line 11 def volume @volume end |
#year ⇒ Object
Returns the value of attribute year.
7 8 9 |
# File 'lib/plos/reference.rb', line 7 def year @year end |