Skip to content

Commit 8c7e82e

Browse files
committed
Privatize unneededly protected methods in Action Mailer
1 parent bbbc3e1 commit 8c7e82e

File tree

4 files changed

+20
-27
lines changed

4 files changed

+20
-27
lines changed

actionmailer/lib/action_mailer/base.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ def deliver_mail(mail) #:nodoc:
544544
end
545545
end
546546

547-
protected
547+
private
548548

549-
def set_payload_for_mail(payload, mail) #:nodoc:
549+
def set_payload_for_mail(payload, mail)
550550
payload[:mailer] = name
551551
payload[:message_id] = mail.message_id
552552
payload[:subject] = mail.subject
@@ -558,16 +558,14 @@ def set_payload_for_mail(payload, mail) #:nodoc:
558558
payload[:mail] = mail.encoded
559559
end
560560

561-
def method_missing(method_name, *args) # :nodoc:
561+
def method_missing(method_name, *args)
562562
if action_methods.include?(method_name.to_s)
563563
MessageDelivery.new(self, method_name, *args)
564564
else
565565
super
566566
end
567567
end
568568

569-
private
570-
571569
def respond_to_missing?(method, include_all = false)
572570
action_methods.include?(method.to_s)
573571
end
@@ -830,7 +828,7 @@ def mail(headers = {}, &block)
830828
message
831829
end
832830

833-
protected
831+
private
834832

835833
# Used by #mail to set the content type of the message.
836834
#
@@ -841,7 +839,7 @@ def mail(headers = {}, &block)
841839
# If there is no content type passed in via headers, and there are no
842840
# attachments, or the message is multipart, then the default content type is
843841
# used.
844-
def set_content_type(m, user_content_type, class_default)
842+
def set_content_type(m, user_content_type, class_default) # :doc:
845843
params = m.content_type_parameters || {}
846844
case
847845
when user_content_type.present?
@@ -863,18 +861,16 @@ def set_content_type(m, user_content_type, class_default)
863861
# If it does not find a translation for the +subject+ under the specified scope it will default to a
864862
# humanized version of the <tt>action_name</tt>.
865863
# If the subject has interpolations, you can pass them through the +interpolations+ parameter.
866-
def default_i18n_subject(interpolations = {})
864+
def default_i18n_subject(interpolations = {}) # :doc:
867865
mailer_scope = self.class.mailer_name.tr("/", ".")
868866
I18n.t(:subject, interpolations.merge(scope: [mailer_scope, action_name], default: action_name.humanize))
869867
end
870868

871869
# Emails do not support relative path links.
872-
def self.supports_path?
870+
def self.supports_path? # :doc:
873871
false
874872
end
875873

876-
private
877-
878874
def apply_defaults(headers)
879875
default_values = self.class.default.map do |key, value|
880876
[

actionmailer/lib/action_mailer/preview.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,22 @@ def preview_name
9494
name.sub(/Preview$/, "").underscore
9595
end
9696

97-
protected
98-
def load_previews #:nodoc:
97+
private
98+
def load_previews
9999
if preview_path
100100
Dir["#{preview_path}/**/*_preview.rb"].each { |file| require_dependency file }
101101
end
102102
end
103103

104-
def preview_path #:nodoc:
104+
def preview_path
105105
Base.preview_path
106106
end
107107

108-
def show_previews #:nodoc:
108+
def show_previews
109109
Base.show_previews
110110
end
111111

112-
def inform_preview_interceptors(message) #:nodoc:
112+
def inform_preview_interceptors(message)
113113
Base.preview_interceptors.each do |interceptor|
114114
interceptor.previewing_email(message)
115115
end

actionmailer/lib/action_mailer/test_case.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,38 +73,36 @@ def determine_default_mailer(name)
7373
end
7474
end
7575

76-
protected
76+
private
7777

78-
def initialize_test_deliveries # :nodoc:
78+
def initialize_test_deliveries
7979
set_delivery_method :test
8080
@old_perform_deliveries = ActionMailer::Base.perform_deliveries
8181
ActionMailer::Base.perform_deliveries = true
8282
ActionMailer::Base.deliveries.clear
8383
end
8484

85-
def restore_test_deliveries # :nodoc:
85+
def restore_test_deliveries
8686
restore_delivery_method
8787
ActionMailer::Base.perform_deliveries = @old_perform_deliveries
8888
end
8989

90-
def set_delivery_method(method) # :nodoc:
90+
def set_delivery_method(method)
9191
@old_delivery_method = ActionMailer::Base.delivery_method
9292
ActionMailer::Base.delivery_method = method
9393
end
9494

95-
def restore_delivery_method # :nodoc:
95+
def restore_delivery_method
9696
ActionMailer::Base.deliveries.clear
9797
ActionMailer::Base.delivery_method = @old_delivery_method
9898
end
9999

100-
def set_expected_mail # :nodoc:
100+
def set_expected_mail
101101
@expected = Mail.new
102102
@expected.content_type ["text", "plain", { "charset" => charset }]
103103
@expected.mime_version = "1.0"
104104
end
105105

106-
private
107-
108106
def charset
109107
"UTF-8"
110108
end

actionmailer/lib/rails/generators/mailer/mailer_generator.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ def create_mailer_file
1919

2020
hook_for :template_engine, :test_framework
2121

22-
protected
23-
def file_name
22+
private
23+
def file_name # :doc:
2424
@_file_name ||= super.gsub(/_mailer/i, "")
2525
end
2626

27-
private
2827
def application_mailer_file_name
2928
@_application_mailer_file_name ||= if mountable_engine?
3029
"app/mailers/#{namespaced_path}/application_mailer.rb"

0 commit comments

Comments
 (0)