Module: Puree::XMLExtractor::PublisherMixin

Included in:
Dataset, Journal, Thesis
Defined in:
lib/puree/xml_extractor/mixins/publisher_mixin.rb

Overview

Publisher extractor mixin.

Instance Method Summary collapse

Instance Method Details

#publisherPuree::Model::PublisherHeader?



10
11
12
13
14
15
16
17
18
19
# File 'lib/puree/xml_extractor/mixins/publisher_mixin.rb', line 10

def publisher
  xpath_result = xpath_query '/publisher'
  h = Puree::Model::PublisherHeader.new
  h.uuid = xpath_result.xpath('@uuid').text.strip
  xpath_result_name = xpath_result.xpath('name/text')
  h.name = xpath_result_name.first.text.strip unless xpath_result_name.empty?
  xpath_result_type = xpath_result.xpath('type/term/text')
  h.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
  h.data? ? h : nil
end