Module: Puree::XMLExtractor::ProjectMixin
- Included in:
- ResearchOutput
- Defined in:
- lib/puree/xml_extractor/mixins/project_mixin.rb
Overview
Project extractor mixin.
Instance Method Summary collapse
Instance Method Details
#projects ⇒ Array<Puree::Model::RelatedContentHeader>
Projects
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/puree/xml_extractor/mixins/project_mixin.rb', line 11 def projects xpath_result = xpath_query '/relatedProjects/relatedProject' data_arr = [] xpath_result.each { |i| = Puree::Model::RelatedContentHeader.new .uuid = i.attr('uuid').strip xpath_result_name = i.xpath('name/text') .title = xpath_result_name.first.text.strip unless xpath_result_name.empty? xpath_result_type = i.xpath('type/term/text') .type = xpath_result_type.first.text.strip unless xpath_result_type.empty? data_arr << } data_arr.uniq { |d| d.uuid } end |