Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c33b5e84
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,发现更多精彩内容 >>
提交
c33b5e84
编写于
10月 17, 2014
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17302 from claudiob/replace-slower-block-call-with-faster-yield
Replace (slower) block.call with (faster) yield
上级
fd56b51f
6aa115e4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
11 addition
and
11 deletion
+11
-11
actionpack/lib/action_controller/metal/mime_responds.rb
actionpack/lib/action_controller/metal/mime_responds.rb
+2
-2
activerecord/test/cases/migrator_test.rb
activerecord/test/cases/migrator_test.rb
+3
-3
activesupport/lib/active_support/testing/time_helpers.rb
activesupport/lib/active_support/testing/time_helpers.rb
+2
-2
railties/lib/rails/generators/actions.rb
railties/lib/rails/generators/actions.rb
+2
-2
railties/lib/rails/generators/actions/create_migration.rb
railties/lib/rails/generators/actions/create_migration.rb
+2
-2
未找到文件。
actionpack/lib/action_controller/metal/mime_responds.rb
浏览文件 @
c33b5e84
...
...
@@ -216,11 +216,11 @@ def respond_with(*)
#
# Be sure to check the documentation of +respond_with+ and
# <tt>ActionController::MimeResponds.respond_to</tt> for more examples.
def
respond_to
(
*
mimes
,
&
block
)
def
respond_to
(
*
mimes
)
raise
ArgumentError
,
"respond_to takes either types or a block, never both"
if
mimes
.
any?
&&
block_given?
collector
=
Collector
.
new
(
mimes
,
request
.
variant
)
block
.
call
(
collector
)
if
block_given?
yield
collector
if
block_given?
if
format
=
collector
.
negotiate_format
(
request
)
_process_format
(
format
)
...
...
activerecord/test/cases/migrator_test.rb
浏览文件 @
c33b5e84
...
...
@@ -357,11 +357,11 @@ def test_get_all_versions
end
private
def
m
(
name
,
version
,
&
block
)
def
m
(
name
,
version
)
x
=
Sensor
.
new
name
,
version
x
.
extend
(
Module
.
new
{
define_method
(
:up
)
{
block
.
call
(
:up
,
x
);
super
()
}
define_method
(
:down
)
{
block
.
call
(
:down
,
x
);
super
()
}
define_method
(
:up
)
{
yield
(
:up
,
x
);
super
()
}
define_method
(
:down
)
{
yield
(
:down
,
x
);
super
()
}
})
if
block_given?
end
...
...
activesupport/lib/active_support/testing/time_helpers.rb
浏览文件 @
c33b5e84
...
...
@@ -90,7 +90,7 @@ def travel(duration, &block)
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
# end
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
def
travel_to
(
date_or_time
,
&
block
)
def
travel_to
(
date_or_time
)
if
date_or_time
.
is_a?
(
Date
)
&&
!
date_or_time
.
is_a?
(
DateTime
)
now
=
date_or_time
.
midnight
.
to_time
else
...
...
@@ -102,7 +102,7 @@ def travel_to(date_or_time, &block)
if
block_given?
begin
block
.
call
yield
ensure
travel_back
end
...
...
railties/lib/rails/generators/actions.rb
浏览文件 @
c33b5e84
...
...
@@ -85,10 +85,10 @@ def add_source(source, options={})
# environment(nil, env: "development") do
# "config.autoload_paths += %W(#{config.root}/extras)"
# end
def
environment
(
data
=
nil
,
options
=
{}
,
&
block
)
def
environment
(
data
=
nil
,
options
=
{})
sentinel
=
/class [a-z_:]+ < Rails::Application/i
env_file_sentinel
=
/Rails\.application\.configure do/
data
=
block
.
call
if
!
data
&&
block_given?
data
=
yield
if
!
data
&&
block_given?
in_root
do
if
options
[
:env
].
nil?
...
...
railties/lib/rails/generators/actions/create_migration.rb
浏览文件 @
c33b5e84
...
...
@@ -39,7 +39,7 @@ def existing_migration
protected
def
on_conflict_behavior
(
&
block
)
def
on_conflict_behavior
options
=
base
.
options
.
merge
(
config
)
if
identical?
say_status
:identical
,
:blue
,
relative_existing_migration
...
...
@@ -48,7 +48,7 @@ def on_conflict_behavior(&block)
say_status
:create
,
:green
unless
pretend?
::
FileUtils
.
rm_rf
(
existing_migration
)
block
.
call
yield
end
elsif
options
[
:skip
]
say_status
:skip
,
:yellow
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录