Sha256: ede71396aaca030edb9053fc2487f2baeb40d6a4847b782151a90ba4f22d8a02

Contents?: true

Size: 872 Bytes

Versions: 2

Compression:

Stored size: 872 Bytes

Contents

module Puree

  module XMLExtractor

    # Research output extractor mixin.
    #
    module ResearchOutputMixin

      # Related research outputs
      # @return [Array<Puree::Model::RelatedContentHeader>]
      def research_outputs
        xpath_result = xpath_query '/relatedResearchOutputs/relatedResearchOutput'
        data_arr = []
        xpath_result.each { |i|
          related = Puree::Model::RelatedContentHeader.new
          related.uuid = i.attr('uuid').strip
          xpath_result_name = i.xpath('names/name')
          related.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
          xpath_result_type = i.xpath('types/type')
          related.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
          data_arr << related
        }
        data_arr.uniq { |d| d.uuid }
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puree-2.8.1 lib/puree/xml_extractor/mixins/research_output_mixin.rb
puree-2.8.0 lib/puree/xml_extractor/mixins/research_output_mixin.rb