class DMARC::Parser
DMARC
parser.
Public Class Methods
parse(record)
click to toggle source
Parses a DMARC
record.
@param [String] record
The raw DMARC record to parse.
@return [Hash{Symbol => Object}]
The Hash of tags within the record.
# File lib/dmarc/parser.rb, line 215 def self.parse(record) tags = Transform.new.apply(new.parse(record)) hash = {} tags.each { |tag| hash.merge!(tag) } return hash end
tag_rule(name,tag,&block)
click to toggle source
# File lib/dmarc/parser.rb, line 44 def self.tag_rule(name,tag,&block) rule(:"dmarc_#{name}") do str(tag) >> wsp? >> str('=') >> wsp? >> (instance_eval(&block).as(tag.to_sym) | unknown_value) end end