aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-09-27 17:37:34 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-09-27 17:37:34 -0700
commitab92058bbdb3240dca2fbf51d86a720ee7bce1ca (patch)
treecaded7c37bd8ba2635c19e528b74261c50d68bb4 /app
parentb1e08b468b7041ef5df179213f686722b0ead358 (diff)
downloadrails-ab92058bbdb3240dca2fbf51d86a720ee7bce1ca.tar.gz
rails-ab92058bbdb3240dca2fbf51d86a720ee7bce1ca.tar.bz2
rails-ab92058bbdb3240dca2fbf51d86a720ee7bce1ca.zip
Sharpen terminology
raw_email_content => source
Diffstat (limited to 'app')
-rw-r--r--app/models/action_mailroom/inbound_email.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/models/action_mailroom/inbound_email.rb b/app/models/action_mailroom/inbound_email.rb
index f9842eead7..6dd643073a 100644
--- a/app/models/action_mailroom/inbound_email.rb
+++ b/app/models/action_mailroom/inbound_email.rb
@@ -13,19 +13,23 @@ class ActionMailroom::InboundEmail < ActiveRecord::Base
create! raw_email: raw_email, message_id: extract_message_id(raw_email), **options
end
- def mail_from_raw_content(raw_email_content)
- Mail.new(Mail::Utilities.binary_unsafe_to_crlf(raw_email_content.to_s))
+ def mail_from_source(source)
+ Mail.new(Mail::Utilities.binary_unsafe_to_crlf(source.to_s))
end
private
def extract_message_id(raw_email)
- mail_from_raw_content(raw_email.read).message_id
+ mail_from_source(raw_email.read).message_id
rescue => e
# TODO: Assign message id if it can't be extracted?
end
end
def mail
- @mail ||= self.class.mail_from_raw_content(raw_email.download)
+ @mail ||= self.class.mail_from_source(source)
+ end
+
+ def source
+ @source ||= raw_email.download
end
end