Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
46a22cea
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
46a22cea
编写于
5月 06, 2020
作者:
R
Ryuta Kamizono
提交者:
GitHub
5月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #39162 from kamipo/dogfooding_symbol_starts_ends_with
Dogfooding "active_support/core_ext/symbol/starts_ends_with"
上级
0caf7b76
98a1405f
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
25 addition
and
15 deletion
+25
-15
actionpack/lib/abstract_controller/translation.rb
actionpack/lib/abstract_controller/translation.rb
+3
-1
actionpack/lib/action_dispatch/http/mime_type.rb
actionpack/lib/action_dispatch/http/mime_type.rb
+5
-4
actionpack/lib/action_dispatch/routing/mapper.rb
actionpack/lib/action_dispatch/routing/mapper.rb
+2
-1
actionpack/lib/action_dispatch/testing/assertions.rb
actionpack/lib/action_dispatch/testing/assertions.rb
+1
-1
actionview/lib/action_view/helpers/form_helper.rb
actionview/lib/action_view/helpers/form_helper.rb
+3
-2
actionview/lib/action_view/helpers/form_tag_helper.rb
actionview/lib/action_view/helpers/form_tag_helper.rb
+2
-1
activerecord/test/cases/callbacks_test.rb
activerecord/test/cases/callbacks_test.rb
+2
-1
activerecord/test/cases/relation/delegation_test.rb
activerecord/test/cases/relation/delegation_test.rb
+2
-1
activesupport/lib/active_support/evented_file_update_checker.rb
...support/lib/active_support/evented_file_update_checker.rb
+1
-1
activesupport/lib/active_support/option_merger.rb
activesupport/lib/active_support/option_merger.rb
+2
-1
railties/lib/rails/commands/server/server_command.rb
railties/lib/rails/commands/server/server_command.rb
+2
-1
未找到文件。
actionpack/lib/abstract_controller/translation.rb
浏览文件 @
46a22cea
# frozen_string_literal: true
require
"active_support/core_ext/symbol/starts_ends_with"
module
AbstractController
module
Translation
# Delegates to <tt>I18n.translate</tt>. Also aliased as <tt>t</tt>.
...
...
@@ -11,7 +13,7 @@ module Translation
# to translate many keys within the same controller / action and gives you a
# simple framework for scoping them consistently.
def
translate
(
key
,
**
options
)
if
key
.
to_s
.
start_with?
(
"."
)
if
key
.
start_with?
(
"."
)
path
=
controller_path
.
tr
(
"/"
,
"."
)
defaults
=
[
:"
#{
path
}#{
key
}
"
]
defaults
<<
options
[
:default
]
if
options
[
:default
]
...
...
actionpack/lib/action_dispatch/http/mime_type.rb
浏览文件 @
46a22cea
# frozen_string_literal: true
require
"singleton"
require
"active_support/core_ext/symbol/starts_ends_with"
module
Mime
class
Mimes
...
...
@@ -305,7 +306,7 @@ def to_ary; end
def
to_a
;
end
def
method_missing
(
method
,
*
args
)
if
method
.
to_s
.
end_with?
"?"
if
method
.
end_with?
(
"?"
)
method
[
0
..-
2
].
downcase
.
to_sym
==
to_sym
else
super
...
...
@@ -313,7 +314,7 @@ def method_missing(method, *args)
end
def
respond_to_missing?
(
method
,
include_private
=
false
)
(
method
.
to_s
.
end_with?
"?"
)
||
super
method
.
end_with?
(
"?"
)
||
super
end
end
...
...
@@ -348,11 +349,11 @@ def ref; end
private
def
respond_to_missing?
(
method
,
_
)
method
.
to_s
.
end_with?
"?"
method
.
end_with?
(
"?"
)
end
def
method_missing
(
method
,
*
args
)
false
if
method
.
to_s
.
end_with?
"?"
false
if
method
.
end_with?
(
"?"
)
end
end
end
...
...
actionpack/lib/action_dispatch/routing/mapper.rb
浏览文件 @
46a22cea
...
...
@@ -4,6 +4,7 @@
require
"active_support/core_ext/enumerable"
require
"active_support/core_ext/array/extract_options"
require
"active_support/core_ext/regexp"
require
"active_support/core_ext/symbol/starts_ends_with"
require
"action_dispatch/routing/redirection"
require
"action_dispatch/routing/endpoint"
...
...
@@ -355,7 +356,7 @@ def split_to(to)
def
add_controller_module
(
controller
,
modyoule
)
if
modyoule
&&
!
controller
.
is_a?
(
Regexp
)
if
controller
.
to_s
.
start_with?
(
"/"
)
if
controller
&
.
start_with?
(
"/"
)
controller
[
1
..-
1
]
else
[
modyoule
,
controller
].
compact
.
join
(
"/"
)
...
...
actionpack/lib/action_dispatch/testing/assertions.rb
浏览文件 @
46a22cea
...
...
@@ -14,7 +14,7 @@ module Assertions
include
Rails
::
Dom
::
Testing
::
Assertions
def
html_document
@html_document
||=
if
@response
.
media_type
.
to_s
.
end_with?
(
"xml"
)
@html_document
||=
if
@response
.
media_type
&
.
end_with?
(
"xml"
)
Nokogiri
::
XML
::
Document
.
parse
(
@response
.
body
)
else
Nokogiri
::
HTML
::
Document
.
parse
(
@response
.
body
)
...
...
actionview/lib/action_view/helpers/form_helper.rb
浏览文件 @
46a22cea
...
...
@@ -2162,6 +2162,7 @@ def fields_for(record_name, record_object = nil, fields_options = {}, &block)
case
record_name
when
String
,
Symbol
record_name
=
record_name
.
to_s
if
nested_attributes_association?
(
record_name
)
return
fields_for_with_nested_attributes
(
record_name
,
record_object
,
fields_options
,
block
)
end
...
...
@@ -2180,8 +2181,8 @@ def fields_for(record_name, record_object = nil, fields_options = {}, &block)
record_name
=
if
index
"
#{
object_name
}
[
#{
index
}
][
#{
record_name
}
]"
elsif
record_name
.
to_s
.
end_with?
(
"[]"
)
record_name
=
record_name
.
to_s
.
sub
(
/(.*)\[\]$/
,
"[
\\
1][
#{
record_object
.
id
}
]"
)
elsif
record_name
.
end_with?
(
"[]"
)
record_name
=
record_name
.
sub
(
/(.*)\[\]$/
,
"[
\\
1][
#{
record_object
.
id
}
]"
)
"
#{
object_name
}#{
record_name
}
"
else
"
#{
object_name
}
[
#{
record_name
}
]"
...
...
actionview/lib/action_view/helpers/form_tag_helper.rb
浏览文件 @
46a22cea
...
...
@@ -4,6 +4,7 @@
require
"action_view/helpers/tag_helper"
require
"active_support/core_ext/string/output_safety"
require
"active_support/core_ext/module/attribute_accessors"
require
"active_support/core_ext/symbol/starts_ends_with"
module
ActionView
# = Action View Form Tag Helpers
...
...
@@ -134,7 +135,7 @@ def form_tag(url_for_options = {}, options = {}, &block)
# # <option selected="selected">MasterCard</option></select>
def
select_tag
(
name
,
option_tags
=
nil
,
options
=
{})
option_tags
||=
""
html_name
=
(
options
[
:multiple
]
==
true
&&
!
name
.
to_s
.
end_with?
(
"[]"
))
?
"
#{
name
}
[]"
:
name
html_name
=
(
options
[
:multiple
]
==
true
&&
!
name
.
end_with?
(
"[]"
))
?
"
#{
name
}
[]"
:
name
if
options
.
include?
(
:include_blank
)
include_blank
=
options
[
:include_blank
]
...
...
activerecord/test/cases/callbacks_test.rb
浏览文件 @
46a22cea
...
...
@@ -3,6 +3,7 @@
require
"cases/helper"
require
"models/developer"
require
"models/computer"
require
"active_support/core_ext/symbol/starts_ends_with"
class
CallbackDeveloper
<
ActiveRecord
::
Base
self
.
table_name
=
"developers"
...
...
@@ -29,7 +30,7 @@ def callback_object(callback_method)
end
ActiveRecord
::
Callbacks
::
CALLBACKS
.
each
do
|
callback_method
|
next
if
callback_method
.
to_s
.
start_with?
(
"around_"
)
next
if
callback_method
.
start_with?
(
"around_"
)
define_callback_method
(
callback_method
)
send
(
callback_method
,
callback_proc
(
callback_method
))
send
(
callback_method
,
callback_object
(
callback_method
))
...
...
activerecord/test/cases/relation/delegation_test.rb
浏览文件 @
46a22cea
...
...
@@ -3,6 +3,7 @@
require
"cases/helper"
require
"models/post"
require
"models/comment"
require
"active_support/core_ext/symbol/starts_ends_with"
module
ActiveRecord
module
DelegationTests
...
...
@@ -50,7 +51,7 @@ class QueryingMethodsDelegationTest < ActiveRecord::TestCase
ActiveRecord
::
FinderMethods
.
public_instance_methods
(
false
)
-
[
:raise_record_not_found_exception!
]
+
ActiveRecord
::
SpawnMethods
.
public_instance_methods
(
false
)
-
[
:spawn
,
:merge!
]
+
ActiveRecord
::
QueryMethods
.
public_instance_methods
(
false
).
reject
{
|
method
|
method
.
to_s
.
end_with?
(
"="
,
"!"
,
"value"
,
"values"
,
"clause"
)
method
.
end_with?
(
"="
,
"!"
,
"value"
,
"values"
,
"clause"
)
}
-
[
:reverse_order
,
:arel
,
:extensions
,
:construct_join_dependency
]
+
[
:any?
,
:many?
,
:none?
,
:one?
,
:first_or_create
,
:first_or_create!
,
:first_or_initialize
,
...
...
activesupport/lib/active_support/evented_file_update_checker.rb
浏览文件 @
46a22cea
...
...
@@ -148,7 +148,7 @@ def directories_to_watch
normalized_gem_paths
=
Gem
.
path
.
map
{
|
path
|
File
.
join
path
,
""
}
dtw
=
dtw
.
reject
do
|
path
|
normalized_gem_paths
.
any?
{
|
gem_path
|
path
.
to_
s
.
start_with?
(
gem_path
)
}
normalized_gem_paths
.
any?
{
|
gem_path
|
path
.
to_
path
.
start_with?
(
gem_path
)
}
end
@ph
.
filter_out_descendants
(
dtw
)
...
...
activesupport/lib/active_support/option_merger.rb
浏览文件 @
46a22cea
# frozen_string_literal: true
require
"active_support/core_ext/hash/deep_merge"
require
"active_support/core_ext/symbol/starts_ends_with"
module
ActiveSupport
class
OptionMerger
#:nodoc:
instance_methods
.
each
do
|
method
|
undef_method
(
method
)
unless
method
.
to_s
.
start_with?
(
"__"
,
"instance_eval"
,
"class"
,
"object_id"
)
undef_method
(
method
)
unless
method
.
start_with?
(
"__"
,
"instance_eval"
,
"class"
,
"object_id"
)
end
def
initialize
(
context
,
options
)
...
...
railties/lib/rails/commands/server/server_command.rb
浏览文件 @
46a22cea
...
...
@@ -5,6 +5,7 @@
require
"rails"
require
"active_support/deprecation"
require
"active_support/core_ext/string/filters"
require
"active_support/core_ext/symbol/starts_ends_with"
require
"rails/dev_caching"
require
"rails/command/environment_argument"
...
...
@@ -178,7 +179,7 @@ def user_supplied_options
# ["-p3001", "-C", "--binding", "127.0.0.1"] # => {"-p"=>true, "-C"=>true, "--binding"=>true}
user_flag
=
{}
@original_options
.
each
do
|
command
|
if
command
.
to_s
.
start_with?
(
"--"
)
if
command
.
start_with?
(
"--"
)
option
=
command
.
split
(
"="
)[
0
]
user_flag
[
option
]
=
true
elsif
command
=~
/\A(-.)/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录