Class: Datacite::Mapping::EmptyFilteringArrayNode

Inherits:
XML::Mapping::ArrayNode
  • Object
show all
Includes:
EmptyNodeUtils
Defined in:
lib/datacite/mapping/empty_filtering_nodes.rb

Overview

An XML::Mapping::ArrayNode that ignores empty tags, including tags containing only blank text.

Instance Method Summary collapse

Methods included from EmptyNodeUtils

#not_empty

Instance Method Details

#extract_attr_value(xml)



23
24
25
26
27
# File 'lib/datacite/mapping/empty_filtering_nodes.rb', line 23

def extract_attr_value(xml)
  elements = default_when_xpath_err { @reader_path.all(xml) }
  non_empty_elements = elements.select { |e| not_empty(e) }
  non_empty_elements.map { |e| unmarshal(e) }
end

#unmarshal(element)



29
30
31
# File 'lib/datacite/mapping/empty_filtering_nodes.rb', line 29

def unmarshal(element)
  @unmarshaller.call(element)
end