module Puree::XMLExtractor::EventMixin

Event extractor mixin.

Public Instance Methods

event() click to toggle source

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

# File lib/puree/xml_extractor/mixins/event_mixin.rb, line 10
def event
  xpath_result = xpath_query '/event'
  if !xpath_result.empty?
    header = Puree::Model::EventHeader.new
    header.uuid = xpath_result.xpath('@uuid').text.strip
    xpath_result_name = xpath_result.xpath('name/text')
    header.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
    return header if header.data?
  end
  nil
end