Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
839362fa
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,发现更多精彩内容 >>
提交
839362fa
编写于
3月 12, 2010
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make all AP tests pass for Ruby 1.9.1.
上级
f10631e1
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
19 addition
and
17 deletion
+19
-17
actionpack/lib/action_view/lookup_context.rb
actionpack/lib/action_view/lookup_context.rb
+11
-8
actionpack/test/dispatch/mount_test.rb
actionpack/test/dispatch/mount_test.rb
+4
-4
actionpack/test/lib/fixture_template.rb
actionpack/test/lib/fixture_template.rb
+3
-2
actionpack/test/template/lookup_context_test.rb
actionpack/test/template/lookup_context_test.rb
+1
-3
未找到文件。
actionpack/lib/action_view/lookup_context.rb
浏览文件 @
839362fa
...
...
@@ -13,18 +13,21 @@ class LookupContext #:nodoc:
mattr_accessor
:registered_details
self
.
registered_details
=
[]
def
self
.
register_detail
(
name
,
options
=
{})
def
self
.
register_detail
(
name
,
options
=
{}
,
&
block
)
self
.
registered_details
<<
name
Setters
.
send
:define_method
,
:"
#{
name
}
="
do
|
value
|
value
=
Array
(
value
.
presence
||
yield
)
value
|=
[
nil
]
unless
options
[
:allow_nil
]
==
false
Setters
.
send
:define_method
,
:"_
#{
name
}
_defaults"
,
&
block
Setters
.
module_eval
<<-
METHOD
,
__FILE__
,
__LINE__
+
1
def
#{
name
}
=(value)
value = Array(value.presence || _
#{
name
}
_defaults)
#{
"value << nil unless value.include?(nil)"
unless
options
[
:allow_nil
]
==
false
}
unless
value
==
@details
[
name
]
@details_key
,
@details
=
nil
,
@details
.
merge
(
name
=>
value
)
unless value == @details[:
#{
name
}
]
@details_key, @details = nil, @details.merge(:
#{
name
}
=> value)
@details.freeze
end
end
METHOD
end
# Holds raw setters for the registered details.
...
...
actionpack/test/dispatch/mount_test.rb
浏览文件 @
839362fa
require
'abstract_unit'
class
TestRoutingMount
<
ActionDispatch
::
IntegrationTest
Router
=
ActionDispatch
::
Routing
::
RouteSet
.
new
Router
.
draw
do
SprocketsApp
=
lambda
{
|
env
|
[
200
,
{
"Content-Type"
=>
"text/html"
},
[
"
#{
env
[
"SCRIPT_NAME"
]
}
--
#{
env
[
"PATH_INFO"
]
}
"
]]
}
Router
=
ActionDispatch
::
Routing
::
RouteSet
.
new
Router
.
draw
do
mount
SprocketsApp
,
:at
=>
"/sprockets"
mount
SprocketsApp
=>
"/shorthand"
...
...
actionpack/test/lib/fixture_template.rb
浏览文件 @
839362fa
...
...
@@ -12,7 +12,7 @@ def initialize(hash = {})
def
query
(
partial
,
path
,
exts
)
query
=
Regexp
.
escape
(
path
)
exts
.
each
do
|
ext
|
query
<<
'(
?:
'
<<
ext
.
map
{
|
e
|
e
&&
Regexp
.
escape
(
".
#{
e
}
"
)
}.
join
(
'|'
)
<<
')'
query
<<
'('
<<
ext
.
map
{
|
e
|
e
&&
Regexp
.
escape
(
".
#{
e
}
"
)
}.
join
(
'|'
)
<<
')'
end
templates
=
[]
...
...
@@ -21,7 +21,8 @@ def query(partial, path, exts)
templates
<<
Template
.
new
(
source
,
path
,
handler
,
:partial
=>
partial
,
:virtual_path
=>
path
,
:format
=>
format
)
end
templates
.
sort_by
{
|
t
|
-
t
.
formats
.
size
}
templates
.
sort_by
{
|
t
|
-
t
.
identifier
.
match
(
/^
#{
query
}
$/
).
captures
.
reject
(
&
:blank?
).
size
}
end
end
...
...
actionpack/test/template/lookup_context_test.rb
浏览文件 @
839362fa
...
...
@@ -33,9 +33,7 @@ def teardown
end
test
"does not allow details to be modified in place"
do
assert_raise
TypeError
do
@lookup_context
.
details
.
clear
end
assert
@lookup_context
.
details
.
frozen?
end
test
"allows me to update an specific detail"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录