Class: Puree::XMLExtractor::JournalArticle
- Inherits:
-
Publication
- Object
- Base
- Resource
- Publication
- Puree::XMLExtractor::JournalArticle
- Includes:
- PageRangeMixin, PagesMixin, PeerReviewedMixin
- Defined in:
- lib/puree/xml_extractor/journal_article.rb
Overview
Journal article XML extractor.
Instance Method Summary collapse
- #article_number ⇒ Fixnum?
-
#initialize(xml:) ⇒ JournalArticle
constructor
A new instance of JournalArticle.
- #issue ⇒ Fixnum?
- #journal ⇒ Puree::Model::JournalHeader?
- #volume ⇒ Fixnum?
Methods included from PeerReviewedMixin
Methods included from PageRangeMixin
Methods included from PagesMixin
Methods inherited from Publication
#bibliographical_note, #category, #description, #dois, #files, #keywords, #language, #links, #organisations, #owner, #persons_external, #persons_internal, #persons_other, #publication_place, #publisher, #statuses, #subtitle, #title, #translated_subtitle, #translated_title, #type
Methods included from WorkflowStateMixin
Methods included from ExternalOrganisationsMixin
Methods included from AssociatedMixin
Methods inherited from Resource
#created, #get_data?, #locale, #modified, #uuid, #xpath_query
Methods inherited from Base
#xpath_query_for_multi_value, #xpath_query_for_single_value
Constructor Details
#initialize(xml:) ⇒ JournalArticle
Returns a new instance of JournalArticle.
11 12 13 |
# File 'lib/puree/xml_extractor/journal_article.rb', line 11 def initialize(xml:) super end |
Instance Method Details
#article_number ⇒ Fixnum?
16 17 18 |
# File 'lib/puree/xml_extractor/journal_article.rb', line 16 def article_number xpath_query_for_single_value('/articleNumber') end |
#issue ⇒ Fixnum?
21 22 23 24 |
# File 'lib/puree/xml_extractor/journal_article.rb', line 21 def issue xpath_result = xpath_query_for_single_value('/journalNumber') xpath_result ? xpath_result.to_i : nil end |
#journal ⇒ Puree::Model::JournalHeader?
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/puree/xml_extractor/journal_article.rb', line 27 def journal xpath_result = xpath_query '/journal' if !xpath_result.empty? header = Puree::Model::JournalHeader.new header.title = xpath_result.xpath('title').text.strip journal = xpath_result.xpath('journal') header.type = journal.xpath('typeClassification/term/localizedString').text.strip header.uuid = journal.attr('uuid').text.strip return header end nil end |
#volume ⇒ Fixnum?
41 42 43 44 |
# File 'lib/puree/xml_extractor/journal_article.rb', line 41 def volume xpath_result = xpath_query_for_single_value('/volume') xpath_result ? xpath_result.to_i : nil end |