Class: PhisherPhinder::MailParser::AuthenticationHeaders::AuthResultsParser
- Inherits:
-
Object
- Object
- PhisherPhinder::MailParser::AuthenticationHeaders::AuthResultsParser
- Defined in:
- lib/phisher_phinder/mail_parser/authentication_headers/auth_results_parser.rb
Instance Method Summary collapse
-
#initialize(ip_factory:) ⇒ AuthResultsParser
constructor
A new instance of AuthResultsParser.
- #parse(value) ⇒ Object
Constructor Details
#initialize(ip_factory:) ⇒ AuthResultsParser
Returns a new instance of AuthResultsParser.
7 8 9 |
# File 'lib/phisher_phinder/mail_parser/authentication_headers/auth_results_parser.rb', line 7 def initialize(ip_factory:) @ip_factory = ip_factory end |
Instance Method Details
#parse(value) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/phisher_phinder/mail_parser/authentication_headers/auth_results_parser.rb', line 11 def parse(value) output_template = {authserv_id: nil, auth: [], dkim: [], dmarc: [], iprev: [], spf: []} components(value).inject(output_template) do |output, component| component_type, parsed_component = parse_component(component) if output[component_type].respond_to?(:<<) output.merge(component_type => (output[component_type] << parsed_component)) else output.merge(component_type => parsed_component) end end end |