Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
9e4827a8
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,发现更多精彩内容 >>
未验证
提交
9e4827a8
编写于
9月 17, 2017
作者:
B
bogdanvlviv
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deprecate `Module#reachable?` method
上级
f8e4c837
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
23 addition
and
10 deletion
+23
-10
activesupport/CHANGELOG.md
activesupport/CHANGELOG.md
+4
-0
activesupport/lib/active_support/core_ext/module/reachable.rb
...vesupport/lib/active_support/core_ext/module/reachable.rb
+1
-0
activesupport/test/core_ext/module/reachable_test.rb
activesupport/test/core_ext/module/reachable_test.rb
+18
-10
未找到文件。
activesupport/CHANGELOG.md
浏览文件 @
9e4827a8
*
Deprecate
`Module#reachable?`
method.
*bogdanvlviv*
*
Add
`config/credentials.yml.enc`
to store production app secrets.
*
Add
`config/credentials.yml.enc`
to store production app secrets.
Allows saving any authentication credentials for third party services
Allows saving any authentication credentials for third party services
...
...
activesupport/lib/active_support/core_ext/module/reachable.rb
浏览文件 @
9e4827a8
...
@@ -7,4 +7,5 @@ class Module
...
@@ -7,4 +7,5 @@ class Module
def
reachable?
#:nodoc:
def
reachable?
#:nodoc:
!
anonymous?
&&
name
.
safe_constantize
.
equal?
(
self
)
!
anonymous?
&&
name
.
safe_constantize
.
equal?
(
self
)
end
end
deprecate
:reachable?
end
end
activesupport/test/core_ext/module/reachable_test.rb
浏览文件 @
9e4827a8
...
@@ -5,14 +5,18 @@
...
@@ -5,14 +5,18 @@
class
AnonymousTest
<
ActiveSupport
::
TestCase
class
AnonymousTest
<
ActiveSupport
::
TestCase
test
"an anonymous class or module is not reachable"
do
test
"an anonymous class or module is not reachable"
do
assert_deprecated
do
assert
!
Module
.
new
.
reachable?
assert
!
Module
.
new
.
reachable?
assert
!
Class
.
new
.
reachable?
assert
!
Class
.
new
.
reachable?
end
end
end
test
"ordinary named classes or modules are reachable"
do
test
"ordinary named classes or modules are reachable"
do
assert_deprecated
do
assert
Kernel
.
reachable?
assert
Kernel
.
reachable?
assert
Object
.
reachable?
assert
Object
.
reachable?
end
end
end
test
"a named class or module whose constant has gone is not reachable"
do
test
"a named class or module whose constant has gone is not reachable"
do
c
=
eval
"class C; end; C"
c
=
eval
"class C; end; C"
...
@@ -21,9 +25,11 @@ class AnonymousTest < ActiveSupport::TestCase
...
@@ -21,9 +25,11 @@ class AnonymousTest < ActiveSupport::TestCase
self
.
class
.
send
(
:remove_const
,
:C
)
self
.
class
.
send
(
:remove_const
,
:C
)
self
.
class
.
send
(
:remove_const
,
:M
)
self
.
class
.
send
(
:remove_const
,
:M
)
assert_deprecated
do
assert
!
c
.
reachable?
assert
!
c
.
reachable?
assert
!
m
.
reachable?
assert
!
m
.
reachable?
end
end
end
test
"a named class or module whose constants store different objects are not reachable"
do
test
"a named class or module whose constants store different objects are not reachable"
do
c
=
eval
"class C; end; C"
c
=
eval
"class C; end; C"
...
@@ -35,9 +41,11 @@ class AnonymousTest < ActiveSupport::TestCase
...
@@ -35,9 +41,11 @@ class AnonymousTest < ActiveSupport::TestCase
eval
"class C; end"
eval
"class C; end"
eval
"module M; end"
eval
"module M; end"
assert_deprecated
do
assert
C
.
reachable?
assert
C
.
reachable?
assert
M
.
reachable?
assert
M
.
reachable?
assert
!
c
.
reachable?
assert
!
c
.
reachable?
assert
!
m
.
reachable?
assert
!
m
.
reachable?
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录