Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
8c7e82e8
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8c7e82e8
编写于
12月 22, 2016
作者:
A
Akira Matsuda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Privatize unneededly protected methods in Action Mailer
上级
bbbc3e16
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
27 deletion
+20
-27
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+7
-11
actionmailer/lib/action_mailer/preview.rb
actionmailer/lib/action_mailer/preview.rb
+5
-5
actionmailer/lib/action_mailer/test_case.rb
actionmailer/lib/action_mailer/test_case.rb
+6
-8
actionmailer/lib/rails/generators/mailer/mailer_generator.rb
actionmailer/lib/rails/generators/mailer/mailer_generator.rb
+2
-3
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
8c7e82e8
...
...
@@ -544,9 +544,9 @@ def deliver_mail(mail) #:nodoc:
end
end
pr
otected
pr
ivate
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 @@ def set_payload_for_mail(payload, mail) #:nodoc:
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 @@ def method_missing(method_name, *args) # :nodoc:
end
end
private
def
respond_to_missing?
(
method
,
include_all
=
false
)
action_methods
.
include?
(
method
.
to_s
)
end
...
...
@@ -830,7 +828,7 @@ def mail(headers = {}, &block)
message
end
pr
otected
pr
ivate
# Used by #mail to set the content type of the message.
#
...
...
@@ -841,7 +839,7 @@ def mail(headers = {}, &block)
# 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 @@ def set_content_type(m, user_content_type, class_default)
# 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
|
[
...
...
actionmailer/lib/action_mailer/preview.rb
浏览文件 @
8c7e82e8
...
...
@@ -94,22 +94,22 @@ def preview_name
name
.
sub
(
/Preview$/
,
""
).
underscore
end
pr
otected
def
load_previews
#:nodoc:
pr
ivate
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
...
...
actionmailer/lib/action_mailer/test_case.rb
浏览文件 @
8c7e82e8
...
...
@@ -73,38 +73,36 @@ def determine_default_mailer(name)
end
end
pr
otected
pr
ivate
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
...
...
actionmailer/lib/rails/generators/mailer/mailer_generator.rb
浏览文件 @
8c7e82e8
...
...
@@ -19,12 +19,11 @@ def create_mailer_file
hook_for
:template_engine
,
:test_framework
pr
otected
def
file_name
pr
ivate
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"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录