Class: Montague::XMLExtractor::Journal

Inherits:
Base
  • Object
show all
Defined in:
lib/montague/xml_extractor/journal.rb

Overview

Journal XML extractor

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Journal

Returns a new instance of Journal.


7
8
9
# File 'lib/montague/xml_extractor/journal.rb', line 7

def initialize(xml)
  super
end

Instance Method Details

#modelMontague::Model::Journal


25
26
27
# File 'lib/montague/xml_extractor/journal.rb', line 25

def model
  models.first unless models.empty?
end

#modelsArray<Montague::Model::Journal>

Returns:


12
13
14
15
16
17
18
19
20
21
22
# File 'lib/montague/xml_extractor/journal.rb', line 12

def models
  data = []
  xpath_result = xpath_query journal_path
  xpath_result.each do |i|
    journal = Montague::Model::Journal.new
    journal.title = i.xpath('jtitle').text.strip
    journal.issn = i.xpath('issn').text.strip
    data << journal
  end
  data
end