Class: PhisherPhinder::MailParser::Parser
- Inherits:
-
Object
- Object
- PhisherPhinder::MailParser::Parser
- Defined in:
- lib/phisher_phinder/mail_parser.rb
Instance Method Summary collapse
-
#initialize(enriched_ip_factory, line_ending) ⇒ Parser
constructor
A new instance of Parser.
- #parse(contents) ⇒ Object
Constructor Details
#initialize(enriched_ip_factory, line_ending) ⇒ Parser
8 9 10 11 |
# File 'lib/phisher_phinder/mail_parser.rb', line 8 def initialize(enriched_ip_factory, line_ending) @line_ending = line_ending @enriched_ip_factory = enriched_ip_factory end |
Instance Method Details
#parse(contents) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/phisher_phinder/mail_parser.rb', line 13 def parse(contents) original_headers, original_body = separate(contents) headers = extract_headers(original_headers) PhisherPhinder::Mail.new( original_email: contents, original_headers: original_headers, original_body: original_body, headers: headers, tracing_headers: generate_tracing_headers(headers), body: MailParser::BodyParser.new.parse(contents), authentication_headers: generate_authentication_headers(headers) ) end |