Module: DmarcParser::XmlHelper

Included in:
AuthResult, Metadata, Policy, Record
Defined in:
lib/dmarc_parser/xml_helper.rb

Instance Method Summary collapse

Instance Method Details

#get_int(xpath) ⇒ Object



14
15
16
17
# File 'lib/dmarc_parser/xml_helper.rb', line 14

def get_int(xpath)
  value = get_text(xpath)
  value ? value.to_i : nil
end

#get_text(xpath) ⇒ Object



5
6
7
# File 'lib/dmarc_parser/xml_helper.rb', line 5

def get_text(xpath)
  @node.xpath(xpath).first.text rescue nil
end

#get_timestamp(xpath) ⇒ Object



9
10
11
12
# File 'lib/dmarc_parser/xml_helper.rb', line 9

def get_timestamp(xpath)
  value = get_text(xpath)
  value ? Time.at(value.to_i) : nil
end