Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
798b5efe
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,发现更多精彩内容 >>
提交
798b5efe
编写于
1月 05, 2012
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4333 from rafaelfranca/patch-1
Change more Array.wrap calls
上级
4751cc21
2e487bc6
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
28 addition
and
35 deletion
+28
-35
actionpack/lib/abstract_controller/callbacks.rb
actionpack/lib/abstract_controller/callbacks.rb
+2
-2
actionpack/lib/abstract_controller/view_paths.rb
actionpack/lib/abstract_controller/view_paths.rb
+1
-1
actionpack/lib/action_controller/metal/helpers.rb
actionpack/lib/action_controller/metal/helpers.rb
+1
-2
actionpack/lib/action_controller/metal/params_wrapper.rb
actionpack/lib/action_controller/metal/params_wrapper.rb
+5
-6
actionpack/lib/action_dispatch/http/filter_parameters.rb
actionpack/lib/action_dispatch/http/filter_parameters.rb
+1
-1
actionpack/lib/action_view/base.rb
actionpack/lib/action_view/base.rb
+1
-2
actionpack/lib/action_view/helpers/form_options_helper.rb
actionpack/lib/action_view/helpers/form_options_helper.rb
+8
-8
actionpack/lib/action_view/lookup_context.rb
actionpack/lib/action_view/lookup_context.rb
+2
-3
actionpack/lib/action_view/renderer/abstract_renderer.rb
actionpack/lib/action_view/renderer/abstract_renderer.rb
+3
-3
actionpack/lib/action_view/renderer/template_renderer.rb
actionpack/lib/action_view/renderer/template_renderer.rb
+0
-1
actionpack/lib/action_view/template.rb
actionpack/lib/action_view/template.rb
+1
-2
actionpack/lib/action_view/template/error.rb
actionpack/lib/action_view/template/error.rb
+1
-2
actionpack/test/abstract_unit.rb
actionpack/test/abstract_unit.rb
+2
-2
未找到文件。
actionpack/lib/abstract_controller/callbacks.rb
浏览文件 @
798b5efe
...
...
@@ -167,7 +167,7 @@ def _insert_callbacks(callbacks, block)
# for details on the allowed parameters.
def
#{
filter
}
_filter(*names, &blk) # def before_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options|
options[:if] = (Array
.wrap(options[:if]) << "!halted") if
#{
filter
==
:after
}
# options[:if] = (Array.wrap
(options[:if]) << "!halted") if false
options[:if] = (Array
(options[:if]) << "!halted") if
#{
filter
==
:after
}
# options[:if] = (Array
(options[:if]) << "!halted") if false
set_callback(:process_action, :
#{
filter
}
, name, options) # set_callback(:process_action, :before, name, options)
end # end
end # end
...
...
@@ -176,7 +176,7 @@ def #{filter}_filter(*names, &blk)
# for details on the allowed parameters.
def prepend_
#{
filter
}
_filter(*names, &blk) # def prepend_before_filter(*names, &blk)
_insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options|
options[:if] = (Array
.wrap(options[:if]) << "!halted") if
#{
filter
==
:after
}
# options[:if] = (Array.wrap
(options[:if]) << "!halted") if false
options[:if] = (Array
(options[:if]) << "!halted") if
#{
filter
==
:after
}
# options[:if] = (Array
(options[:if]) << "!halted") if false
set_callback(:process_action, :
#{
filter
}
, name, options.merge(:prepend => true)) # set_callback(:process_action, :before, name, options.merge(:prepend => true))
end # end
end # end
...
...
actionpack/lib/abstract_controller/view_paths.rb
浏览文件 @
798b5efe
...
...
@@ -89,7 +89,7 @@ def view_paths
# * <tt>paths</tt> - If a PathSet is provided, use that;
# otherwise, process the parameter into a PathSet.
def
view_paths
=
(
paths
)
self
.
_view_paths
=
ActionView
::
PathSet
.
new
(
Array
.
wrap
(
paths
))
self
.
_view_paths
=
ActionView
::
PathSet
.
new
(
Array
(
paths
))
end
end
end
...
...
actionpack/lib/action_controller/metal/helpers.rb
浏览文件 @
798b5efe
require
'active_support/core_ext/array/wrap'
require
'active_support/core_ext/class/attribute'
module
ActionController
...
...
@@ -94,7 +93,7 @@ def modules_for_helpers(args)
def
all_helpers_from_path
(
path
)
helpers
=
[]
Array
.
wrap
(
path
).
each
do
|
_path
|
Array
(
path
).
each
do
|
_path
|
extract
=
/^
#{
Regexp
.
quote
(
_path
.
to_s
)
}
\/?(.*)_helper.rb$/
helpers
+=
Dir
[
"
#{
_path
}
/**/*_helper.rb"
].
map
{
|
file
|
file
.
sub
(
extract
,
'\1'
)
}
end
...
...
actionpack/lib/action_controller/metal/params_wrapper.rb
浏览文件 @
798b5efe
require
'active_support/core_ext/class/attribute'
require
'active_support/core_ext/hash/slice'
require
'active_support/core_ext/hash/except'
require
'active_support/core_ext/array/wrap'
require
'active_support/core_ext/module/anonymous'
require
'action_dispatch/http/mime_types'
...
...
@@ -180,9 +179,9 @@ def _set_wrapper_defaults(options, model=nil)
controller_name
.
singularize
end
options
[
:include
]
=
Array
.
wrap
(
options
[
:include
]).
collect
(
&
:to_s
)
if
options
[
:include
]
options
[
:exclude
]
=
Array
.
wrap
(
options
[
:exclude
]).
collect
(
&
:to_s
)
if
options
[
:exclude
]
options
[
:format
]
=
Array
.
wrap
(
options
[
:format
])
options
[
:include
]
=
Array
(
options
[
:include
]).
collect
(
&
:to_s
)
if
options
[
:include
]
options
[
:exclude
]
=
Array
(
options
[
:exclude
]).
collect
(
&
:to_s
)
if
options
[
:exclude
]
options
[
:format
]
=
Array
(
options
[
:format
])
self
.
_wrapper_options
=
options
end
...
...
actionpack/lib/action_dispatch/http/filter_parameters.rb
浏览文件 @
798b5efe
...
...
@@ -50,7 +50,7 @@ def parameter_filter
end
def
env_filter
parameter_filter_for
(
Array
.
wrap
(
@env
[
"action_dispatch.parameter_filter"
])
<<
/RAW_POST_DATA/
)
parameter_filter_for
(
Array
(
@env
[
"action_dispatch.parameter_filter"
])
<<
/RAW_POST_DATA/
)
end
def
parameter_filter_for
(
filters
)
...
...
actionpack/lib/action_view/base.rb
浏览文件 @
798b5efe
require
'active_support/core_ext/module/attr_internal'
require
'active_support/core_ext/module/delegation'
require
'active_support/core_ext/class/attribute'
require
'active_support/core_ext/array/wrap'
require
'active_support/ordered_options'
require
'action_view/log_subscriber'
require
'active_support/core_ext/module/deprecation'
...
...
@@ -160,7 +159,7 @@ def cache_template_loading=(value)
def
process_view_paths
(
value
)
value
.
is_a?
(
PathSet
)
?
value
.
dup
:
ActionView
::
PathSet
.
new
(
Array
.
wrap
(
value
))
value
.
dup
:
ActionView
::
PathSet
.
new
(
Array
(
value
))
end
deprecate
:process_view_paths
...
...
actionpack/lib/action_view/helpers/form_options_helper.rb
浏览文件 @
798b5efe
...
...
@@ -322,8 +322,8 @@ def time_zone_select(object, method, priority_zones = nil, options = {}, html_op
def
options_for_select
(
container
,
selected
=
nil
)
return
container
if
String
===
container
selected
,
disabled
=
extract_selected_and_disabled
(
selected
).
map
do
|
r
|
Array
.
wrap
(
r
).
map
{
|
item
|
item
.
to_s
}
selected
,
disabled
=
extract_selected_and_disabled
(
selected
).
map
do
|
r
|
Array
(
r
).
map
{
|
item
|
item
.
to_s
}
end
container
.
map
do
|
element
|
...
...
@@ -333,7 +333,6 @@ def options_for_select(container, selected = nil)
disabled_attribute
=
' disabled="disabled"'
if
disabled
&&
option_value_selected?
(
value
,
disabled
)
%(<option value="#{ERB::Util.html_escape(value)}"#{selected_attribute}#{disabled_attribute}#{html_attributes}>#{ERB::Util.html_escape(text)}</option>)
end
.
join
(
"
\n
"
).
html_safe
end
# Returns a string of option tags that have been compiled by iterating over the +collection+ and assigning the
...
...
@@ -558,7 +557,8 @@ def extract_selected_and_disabled(selected)
else
selected
=
Array
.
wrap
(
selected
)
options
=
selected
.
extract_options!
.
symbolize_keys
[
options
.
include?
(
:selected
)
?
options
[
:selected
]
:
selected
,
options
[
:disabled
]
]
selected_items
=
options
.
include?
(
:selected
)
?
options
[
:selected
]
:
selected
[
selected_items
,
options
[
:disabled
]
]
end
end
...
...
actionpack/lib/action_view/lookup_context.rb
浏览文件 @
798b5efe
require
'active_support/core_ext/array/wrap'
require
'active_support/core_ext/object/blank'
require
'active_support/core_ext/module/remove_method'
...
...
@@ -29,7 +28,7 @@ def #{name}
end
def
#{
name
}
=(value)
value = value.present? ? Array
.wrap
(value) : default_
#{
name
}
value = value.present? ? Array(value) : default_
#{
name
}
_set_detail(:
#{
name
}
, value) if value != @details[:
#{
name
}
]
end
...
...
@@ -102,7 +101,7 @@ module ViewPaths
# Whenever setting view paths, makes a copy so we can manipulate then in
# instance objects as we wish.
def
view_paths
=
(
paths
)
@view_paths
=
ActionView
::
PathSet
.
new
(
Array
.
wrap
(
paths
))
@view_paths
=
ActionView
::
PathSet
.
new
(
Array
(
paths
))
end
def
find
(
name
,
prefixes
=
[],
partial
=
false
,
keys
=
[],
options
=
{})
...
...
actionpack/lib/action_view/renderer/abstract_renderer.rb
浏览文件 @
798b5efe
...
...
@@ -17,7 +17,7 @@ def extract_details(options)
details
=
{}
@lookup_context
.
registered_details
.
each
do
|
key
|
next
unless
value
=
options
[
key
]
details
[
key
]
=
Array
.
wrap
(
value
)
details
[
key
]
=
Array
(
value
)
end
details
end
...
...
actionpack/lib/action_view/renderer/template_renderer.rb
浏览文件 @
798b5efe
require
'active_support/core_ext/object/try'
require
'active_support/core_ext/array/wrap'
module
ActionView
class
TemplateRenderer
<
AbstractRenderer
#:nodoc:
...
...
actionpack/lib/action_view/template.rb
浏览文件 @
798b5efe
require
'active_support/core_ext/array/wrap'
require
'active_support/core_ext/object/blank'
require
'active_support/core_ext/object/try'
require
'active_support/core_ext/kernel/singleton_class'
...
...
@@ -122,7 +121,7 @@ def initialize(source, identifier, handler, details)
@locals
=
details
[
:locals
]
||
[]
@virtual_path
=
details
[
:virtual_path
]
@updated_at
=
details
[
:updated_at
]
||
Time
.
now
@formats
=
Array
.
wrap
(
format
).
map
{
|
f
|
f
.
is_a?
(
Mime
::
Type
)
?
f
.
ref
:
f
}
@formats
=
Array
(
format
).
map
{
|
f
|
f
.
is_a?
(
Mime
::
Type
)
?
f
.
ref
:
f
}
end
# Returns if the underlying handler supports streaming. If so,
...
...
actionpack/lib/action_view/template/error.rb
浏览文件 @
798b5efe
require
"active_support/core_ext/array/wrap"
require
"active_support/core_ext/enumerable"
module
ActionView
...
...
@@ -30,7 +29,7 @@ class MissingTemplate < ActionViewError #:nodoc:
def
initialize
(
paths
,
path
,
prefixes
,
partial
,
details
,
*
)
@path
=
path
prefixes
=
Array
.
wrap
(
prefixes
)
prefixes
=
Array
(
prefixes
)
template_type
=
if
partial
"partial"
elsif
path
=~
/layouts/i
...
...
actionpack/test/abstract_unit.rb
浏览文件 @
798b5efe
...
...
@@ -254,7 +254,7 @@ def get(thing, *args)
end
def
assert_body
(
body
)
assert_equal
body
,
Array
.
wrap
(
response
.
body
).
join
assert_equal
body
,
Array
(
response
.
body
).
join
end
def
assert_status
(
code
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录