module Puree::XMLExtractor::PublisherMixin

Publisher extractor mixin.

Public Instance Methods

publisher() click to toggle source

@return [Puree::Model::PublisherHeader, nil]

# 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