Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c7ee2446
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,发现更多精彩内容 >>
提交
c7ee2446
编写于
4月 25, 2017
作者:
R
Rafael França
提交者:
GitHub
4月 25, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #28831 from kamipo/respond_to_missing_should_be_private
`respond_to_missing?` should be private
上级
550b5e08
ca9ac310
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
40 addition
and
46 deletion
+40
-46
actionpack/lib/action_dispatch/http/mime_type.rb
actionpack/lib/action_dispatch/http/mime_type.rb
+4
-4
actionpack/lib/action_dispatch/routing/routes_proxy.rb
actionpack/lib/action_dispatch/routing/routes_proxy.rb
+3
-2
actionpack/lib/action_dispatch/testing/integration.rb
actionpack/lib/action_dispatch/testing/integration.rb
+6
-5
activerecord/lib/active_record/dynamic_matchers.rb
activerecord/lib/active_record/dynamic_matchers.rb
+8
-9
activerecord/lib/active_record/migration/command_recorder.rb
activerecord/lib/active_record/migration/command_recorder.rb
+6
-6
activerecord/lib/active_record/relation/delegation.rb
activerecord/lib/active_record/relation/delegation.rb
+3
-5
activerecord/test/cases/associations/has_many_associations_test.rb
...ord/test/cases/associations/has_many_associations_test.rb
+0
-1
activerecord/test/cases/relations_test.rb
activerecord/test/cases/relations_test.rb
+1
-5
activesupport/lib/active_support/duration.rb
activesupport/lib/active_support/duration.rb
+5
-5
railties/lib/rails/railtie.rb
railties/lib/rails/railtie.rb
+4
-4
未找到文件。
actionpack/lib/action_dispatch/http/mime_type.rb
浏览文件 @
c7ee2446
...
...
@@ -326,11 +326,11 @@ def nil?
def
ref
;
end
def
respond_to_missing?
(
method
,
include_private
=
false
)
method
.
to_s
.
ends_with?
"?"
end
private
def
respond_to_missing?
(
method
,
_
)
method
.
to_s
.
ends_with?
"?"
end
def
method_missing
(
method
,
*
args
)
false
if
method
.
to_s
.
ends_with?
"?"
end
...
...
actionpack/lib/action_dispatch/routing/routes_proxy.rb
浏览文件 @
c7ee2446
...
...
@@ -19,7 +19,8 @@ def url_options
end
end
def
respond_to_missing?
(
method
,
include_private
=
false
)
private
def
respond_to_missing?
(
method
,
_
)
super
||
@helpers
.
respond_to?
(
method
)
end
...
...
@@ -32,7 +33,7 @@ def #{method}(*args)
@helpers.
#{
method
}
(*args)
end
RUBY
send
(
method
,
*
args
)
public_
send
(
method
,
*
args
)
else
super
end
...
...
actionpack/lib/action_dispatch/testing/integration.rb
浏览文件 @
c7ee2446
...
...
@@ -385,14 +385,15 @@ def default_url_options=(options)
integration_session
.
default_url_options
=
options
end
def
respond_to_missing?
(
method
,
include_private
=
false
)
integration_session
.
respond_to?
(
method
,
include_private
)
||
super
private
def
respond_to_missing?
(
method
,
_
)
integration_session
.
respond_to?
(
method
)
||
super
end
# Delegate unhandled messages to the current session instance.
def
method_missing
(
sym
,
*
args
,
&
block
)
if
integration_session
.
respond_to?
(
sym
)
integration_session
.
__send__
(
sym
,
*
args
,
&
block
).
tap
do
def
method_missing
(
method
,
*
args
,
&
block
)
if
integration_session
.
respond_to?
(
method
)
integration_session
.
public_send
(
method
,
*
args
,
&
block
).
tap
do
copy_session_variables!
end
else
...
...
activerecord/lib/active_record/dynamic_matchers.rb
浏览文件 @
c7ee2446
module
ActiveRecord
module
DynamicMatchers
#:nodoc:
def
respond_to_missing?
(
name
,
include_private
=
false
)
if
self
==
Base
super
else
match
=
Method
.
match
(
self
,
name
)
match
&&
match
.
valid?
||
super
end
end
private
def
respond_to_missing?
(
name
,
_
)
if
self
==
Base
super
else
match
=
Method
.
match
(
self
,
name
)
match
&&
match
.
valid?
||
super
end
end
def
method_missing
(
name
,
*
arguments
,
&
block
)
match
=
Method
.
match
(
self
,
name
)
...
...
activerecord/lib/active_record/migration/command_recorder.rb
浏览文件 @
c7ee2446
...
...
@@ -92,10 +92,6 @@ def inverse_of(command, args, &block)
send
(
method
,
args
,
&
block
)
end
def
respond_to_missing?
(
*
args
)
# :nodoc:
super
||
delegate
.
respond_to?
(
*
args
)
end
ReversibleAndIrreversibleMethods
.
each
do
|
method
|
class_eval
<<-
EOV
,
__FILE__
,
__LINE__
+
1
def
#{
method
}
(*args, &block) # def create_table(*args, &block)
...
...
@@ -225,10 +221,14 @@ def invert_remove_foreign_key(args)
[
:add_foreign_key
,
reversed_args
]
end
def
respond_to_missing?
(
method
,
_
)
super
||
delegate
.
respond_to?
(
method
)
end
# Forwards any missing method call to the \target.
def
method_missing
(
method
,
*
args
,
&
block
)
if
@
delegate
.
respond_to?
(
method
)
@delegate
.
send
(
method
,
*
args
,
&
block
)
if
delegate
.
respond_to?
(
method
)
delegate
.
public_
send
(
method
,
*
args
,
&
block
)
else
super
end
...
...
activerecord/lib/active_record/relation/delegation.rb
浏览文件 @
c7ee2446
...
...
@@ -109,12 +109,10 @@ def relation_class_for(klass)
end
end
def
respond_to_missing?
(
method
,
include_private
=
false
)
super
||
@klass
.
respond_to?
(
method
,
include_private
)
||
arel
.
respond_to?
(
method
,
include_private
)
end
private
def
respond_to_missing?
(
method
,
_
)
super
||
@klass
.
respond_to?
(
method
)
||
arel
.
respond_to?
(
method
)
end
def
method_missing
(
method
,
*
args
,
&
block
)
if
@klass
.
respond_to?
(
method
)
...
...
activerecord/test/cases/associations/has_many_associations_test.rb
浏览文件 @
c7ee2446
...
...
@@ -2040,7 +2040,6 @@ def test_sending_new_to_association_proxy_should_have_same_effect_as_calling_new
def
test_respond_to_private_class_methods
client_association
=
companies
(
:first_firm
).
clients
assert
!
client_association
.
respond_to?
(
:private_method
)
assert
client_association
.
respond_to?
(
:private_method
,
true
)
end
def
test_creating_using_primary_key
...
...
activerecord/test/cases/relations_test.rb
浏览文件 @
c7ee2446
...
...
@@ -594,7 +594,7 @@ def test_scoped_responds_to_delegated_methods
end
end
def
test_respond_to_delegates_to_
relation
def
test_respond_to_delegates_to_
arel
relation
=
Topic
.
all
fake_arel
=
Struct
.
new
(
:responds
)
{
def
respond_to?
(
method
,
access
=
false
)
...
...
@@ -607,10 +607,6 @@ def respond_to?(method, access = false)
relation
.
respond_to?
(
:matching_attributes
)
assert_equal
[
:matching_attributes
,
false
],
fake_arel
.
responds
.
first
fake_arel
.
responds
=
[]
relation
.
respond_to?
(
:matching_attributes
,
true
)
assert_equal
[
:matching_attributes
,
true
],
fake_arel
.
responds
.
first
end
def
test_respond_to_dynamic_finders
...
...
activesupport/lib/active_support/duration.rb
浏览文件 @
c7ee2446
...
...
@@ -305,10 +305,6 @@ def as_json(options = nil) #:nodoc:
to_i
end
def
respond_to_missing?
(
method
,
include_private
=
false
)
#:nodoc:
@value
.
respond_to?
(
method
,
include_private
)
end
# Build ISO 8601 Duration string for this duration.
# The +precision+ parameter can be used to limit seconds' precision of duration.
def
iso8601
(
precision:
nil
)
...
...
@@ -335,8 +331,12 @@ def sum(sign, time = ::Time.current)
end
end
def
respond_to_missing?
(
method
,
_
)
value
.
respond_to?
(
method
)
end
def
method_missing
(
method
,
*
args
,
&
block
)
value
.
send
(
method
,
*
args
,
&
block
)
value
.
public_
send
(
method
,
*
args
,
&
block
)
end
def
raise_type_error
(
other
)
...
...
railties/lib/rails/railtie.rb
浏览文件 @
c7ee2446
...
...
@@ -162,10 +162,6 @@ def instance
@instance
||=
new
end
def
respond_to_missing?
(
*
args
)
instance
.
respond_to?
(
*
args
)
||
super
end
# Allows you to configure the railtie. This is the same method seen in
# Railtie::Configurable, but this module is no longer required for all
# subclasses of Railtie so we provide the class method here.
...
...
@@ -178,6 +174,10 @@ def generate_railtie_name(string)
ActiveSupport
::
Inflector
.
underscore
(
string
).
tr
(
"/"
,
"_"
)
end
def
respond_to_missing?
(
name
,
_
)
instance
.
respond_to?
(
name
)
||
super
end
# If the class method does not have a method, then send the method call
# to the Railtie instance.
def
method_missing
(
name
,
*
args
,
&
block
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录