aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2016-12-22 18:57:02 +0900
committerAkira Matsuda <ronnie@dio.jp>2016-12-24 21:01:07 +0900
commit8c7e82e8e0fa6b785ea2666bfd916d4884856a68 (patch)
treeea6a8c9af51245416f1653c0259744bafd28c3ac /actionmailer
parentbbbc3e161934efdccd2a859fe18cff999585f9db (diff)
downloadrails-8c7e82e8e0fa6b785ea2666bfd916d4884856a68.tar.gz
rails-8c7e82e8e0fa6b785ea2666bfd916d4884856a68.tar.bz2
rails-8c7e82e8e0fa6b785ea2666bfd916d4884856a68.zip
Privatize unneededly protected methods in Action Mailer
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/lib/action_mailer/base.rb18
-rw-r--r--actionmailer/lib/action_mailer/preview.rb10
-rw-r--r--actionmailer/lib/action_mailer/test_case.rb14
-rw-r--r--actionmailer/lib/rails/generators/mailer/mailer_generator.rb5
4 files changed, 20 insertions, 27 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index e331eff3c8..19408f2a48 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -544,9 +544,9 @@ module ActionMailer
end
end
- protected
+ private
- def set_payload_for_mail(payload, mail) #:nodoc:
+ def set_payload_for_mail(payload, mail)
payload[:mailer] = name
payload[:message_id] = mail.message_id
payload[:subject] = mail.subject
@@ -558,7 +558,7 @@ module ActionMailer
payload[:mail] = mail.encoded
end
- def method_missing(method_name, *args) # :nodoc:
+ def method_missing(method_name, *args)
if action_methods.include?(method_name.to_s)
MessageDelivery.new(self, method_name, *args)
else
@@ -566,8 +566,6 @@ module ActionMailer
end
end
- private
-
def respond_to_missing?(method, include_all = false)
action_methods.include?(method.to_s)
end
@@ -830,7 +828,7 @@ module ActionMailer
message
end
- protected
+ private
# Used by #mail to set the content type of the message.
#
@@ -841,7 +839,7 @@ module ActionMailer
# If there is no content type passed in via headers, and there are no
# attachments, or the message is multipart, then the default content type is
# used.
- def set_content_type(m, user_content_type, class_default)
+ def set_content_type(m, user_content_type, class_default) # :doc:
params = m.content_type_parameters || {}
case
when user_content_type.present?
@@ -863,18 +861,16 @@ module ActionMailer
# If it does not find a translation for the +subject+ under the specified scope it will default to a
# humanized version of the <tt>action_name</tt>.
# If the subject has interpolations, you can pass them through the +interpolations+ parameter.
- def default_i18n_subject(interpolations = {})
+ def default_i18n_subject(interpolations = {}) # :doc:
mailer_scope = self.class.mailer_name.tr("/", ".")
I18n.t(:subject, interpolations.merge(scope: [mailer_scope, action_name], default: action_name.humanize))
end
# Emails do not support relative path links.
- def self.supports_path?
+ def self.supports_path? # :doc:
false
end
- private
-
def apply_defaults(headers)
default_values = self.class.default.map do |key, value|
[
diff --git a/actionmailer/lib/action_mailer/preview.rb b/actionmailer/lib/action_mailer/preview.rb
index 93a11453bf..c147ca78d0 100644
--- a/actionmailer/lib/action_mailer/preview.rb
+++ b/actionmailer/lib/action_mailer/preview.rb
@@ -94,22 +94,22 @@ module ActionMailer
name.sub(/Preview$/, "").underscore
end
- protected
- def load_previews #:nodoc:
+ private
+ def load_previews
if preview_path
Dir["#{preview_path}/**/*_preview.rb"].each { |file| require_dependency file }
end
end
- def preview_path #:nodoc:
+ def preview_path
Base.preview_path
end
- def show_previews #:nodoc:
+ def show_previews
Base.show_previews
end
- def inform_preview_interceptors(message) #:nodoc:
+ def inform_preview_interceptors(message)
Base.preview_interceptors.each do |interceptor|
interceptor.previewing_email(message)
end
diff --git a/actionmailer/lib/action_mailer/test_case.rb b/actionmailer/lib/action_mailer/test_case.rb
index 1d09a4ee96..ebc7b37961 100644
--- a/actionmailer/lib/action_mailer/test_case.rb
+++ b/actionmailer/lib/action_mailer/test_case.rb
@@ -73,38 +73,36 @@ module ActionMailer
end
end
- protected
+ private
- def initialize_test_deliveries # :nodoc:
+ def initialize_test_deliveries
set_delivery_method :test
@old_perform_deliveries = ActionMailer::Base.perform_deliveries
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
end
- def restore_test_deliveries # :nodoc:
+ def restore_test_deliveries
restore_delivery_method
ActionMailer::Base.perform_deliveries = @old_perform_deliveries
end
- def set_delivery_method(method) # :nodoc:
+ def set_delivery_method(method)
@old_delivery_method = ActionMailer::Base.delivery_method
ActionMailer::Base.delivery_method = method
end
- def restore_delivery_method # :nodoc:
+ def restore_delivery_method
ActionMailer::Base.deliveries.clear
ActionMailer::Base.delivery_method = @old_delivery_method
end
- def set_expected_mail # :nodoc:
+ def set_expected_mail
@expected = Mail.new
@expected.content_type ["text", "plain", { "charset" => charset }]
@expected.mime_version = "1.0"
end
- private
-
def charset
"UTF-8"
end
diff --git a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
index 9dd7ee7a27..4a8d0178de 100644
--- a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
+++ b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
@@ -19,12 +19,11 @@ module Rails
hook_for :template_engine, :test_framework
- protected
- def file_name
+ private
+ def file_name # :doc:
@_file_name ||= super.gsub(/_mailer/i, "")
end
- private
def application_mailer_file_name
@_application_mailer_file_name ||= if mountable_engine?
"app/mailers/#{namespaced_path}/application_mailer.rb"