Module: Puree::XMLExtractor::IdentifierMixin

Included in:
Person, Project
Defined in:
lib/puree/xml_extractor/mixins/identifier_mixin.rb

Overview

Identifier mixin.

Instance Method Summary collapse

Instance Method Details

#identifiersArray<Model::Identifier>

Returns:



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

def identifiers
  xpath_result = xpath_query '/ids/id'
  data = []
  xpath_result.each do |d|
    identifier = Puree::Model::Identifier.new
    identifier.id = d.xpath('value').text.strip
    identifier.type = d.xpath('type/term/text').text.strip
    data << identifier
  end
  data.uniq { |d| d.id }
end