Class: Astrotrain::LoggedMail
- Inherits:
-
Object
- Object
- Astrotrain::LoggedMail
- Includes:
- DataMapper::Resource
- Defined in:
- lib/astrotrain/logged_mail.rb
Overview
Logs details of each incoming message.
Class Attribute Summary collapse
-
.log_path ⇒ Object
Returns the value of attribute log_path.
-
.log_processed ⇒ Object
Returns the value of attribute log_processed.
Class Method Summary collapse
Class Attribute Details
.log_path ⇒ Object
Returns the value of attribute log_path.
7 8 9 |
# File 'lib/astrotrain/logged_mail.rb', line 7 def log_path @log_path end |
.log_processed ⇒ Object
Returns the value of attribute log_processed.
7 8 9 |
# File 'lib/astrotrain/logged_mail.rb', line 7 def log_processed @log_processed end |
Class Method Details
.from(message, file = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/astrotrain/logged_mail.rb', line 27 def self.from(, file = nil) logged = new begin logged. = . logged.sender = Message.parse_email_addresses(.sender).first logged.subject = .subject logged.mail_file = file if file end if !block_given? || yield(logged) begin logged.save if logged.delivered_at && File.exist?(logged.mail_file.to_s) FileUtils.rm_rf logged.mail_file end rescue puts $!.inspect end end logged end |