Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
76cd4cb2
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,发现更多精彩内容 >>
提交
76cd4cb2
编写于
9月 12, 2009
作者:
Y
Yehuda Katz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Memoize in the endpoint.
上级
ddb4600c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
100 deletion
+11
-100
.gitignore
.gitignore
+1
-1
actionpack/lib/action_controller/metal.rb
actionpack/lib/action_controller/metal.rb
+10
-5
actionpack/vendor/gems/environment.rb
actionpack/vendor/gems/environment.rb
+0
-94
未找到文件。
.gitignore
浏览文件 @
76cd4cb2
...
...
@@ -30,5 +30,5 @@ railties/guides/output
actionpack/bin
*/vendor/gems/gems
*/vendor/gems/specifications
*
/vendor/gems/environment.rb
actionpack
/vendor/gems/environment.rb
*/vendor/gems/dirs/specifications
\ No newline at end of file
actionpack/lib/action_controller/metal.rb
浏览文件 @
76cd4cb2
...
...
@@ -79,6 +79,15 @@ def to_a
end
class
ActionEndpoint
@@endpoints
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
{}
}
}
def
self
.
for
(
controller
,
action
,
stack
)
@@endpoints
[
controller
][
action
][
stack
]
||=
begin
endpoint
=
new
(
controller
,
action
)
stack
.
build
(
endpoint
)
end
end
def
initialize
(
controller
,
action
)
@controller
,
@action
=
controller
,
action
end
...
...
@@ -108,11 +117,7 @@ def self.middleware
# ==== Returns
# Proc:: A rack application
def
self
.
action
(
name
)
@actions
||=
{}
@actions
[
name
.
to_s
]
||=
begin
endpoint
=
ActionEndpoint
.
new
(
self
,
name
)
middleware_stack
.
build
(
endpoint
)
end
ActionEndpoint
.
for
(
self
,
name
,
middleware_stack
)
end
end
end
actionpack/vendor/gems/environment.rb
已删除
100644 → 0
浏览文件 @
ddb4600c
# DO NOT MODIFY THIS FILE
module
Bundler
dir
=
File
.
dirname
(
__FILE__
)
ENV
[
"PATH"
]
=
"
#{
dir
}
/../../bin:
#{
ENV
[
"PATH"
]
}
"
ENV
[
"RUBYOPT"
]
=
"-r
#{
__FILE__
}
#{
ENV
[
"RUBYOPT"
]
}
"
$LOAD_PATH
.
unshift
File
.
expand_path
(
"
#{
dir
}
/dirs/gems/activemodel-3.0.pre/bin"
)
$LOAD_PATH
.
unshift
File
.
expand_path
(
"
#{
dir
}
/../../../activemodel/lib"
)
$LOAD_PATH
.
unshift
File
.
expand_path
(
"
#{
dir
}
/dirs/gems/activesupport-3.0.pre/bin"
)
$LOAD_PATH
.
unshift
File
.
expand_path
(
"
#{
dir
}
/../../../activesupport/lib"
)
$LOAD_PATH
.
unshift
File
.
expand_path
(
"
#{
dir
}
/gems/rack-1.0.0/bin"
)
$LOAD_PATH
.
unshift
File
.
expand_path
(
"
#{
dir
}
/gems/rack-1.0.0/lib"
)
$LOAD_PATH
.
unshift
File
.
expand_path
(
"
#{
dir
}
/gems/rack-test-0.4.2/bin"
)
$LOAD_PATH
.
unshift
File
.
expand_path
(
"
#{
dir
}
/gems/rack-test-0.4.2/lib"
)
@gemfile
=
"
#{
dir
}
/../../Gemfile"
require
"rubygems"
@bundled_specs
=
{}
@bundled_specs
[
"rack"
]
=
eval
(
File
.
read
(
"
#{
dir
}
/specifications/rack-1.0.0.gemspec"
))
@bundled_specs
[
"rack"
].
loaded_from
=
"
#{
dir
}
/specifications/rack-1.0.0.gemspec"
@bundled_specs
[
"activemodel"
]
=
eval
(
File
.
read
(
"
#{
dir
}
/dirs/specifications/activemodel-3.0.pre.gemspec"
))
@bundled_specs
[
"activemodel"
].
loaded_from
=
"
#{
dir
}
/dirs/specifications/activemodel-3.0.pre.gemspec"
@bundled_specs
[
"rack-test"
]
=
eval
(
File
.
read
(
"
#{
dir
}
/specifications/rack-test-0.4.2.gemspec"
))
@bundled_specs
[
"rack-test"
].
loaded_from
=
"
#{
dir
}
/specifications/rack-test-0.4.2.gemspec"
@bundled_specs
[
"activesupport"
]
=
eval
(
File
.
read
(
"
#{
dir
}
/dirs/specifications/activesupport-3.0.pre.gemspec"
))
@bundled_specs
[
"activesupport"
].
loaded_from
=
"
#{
dir
}
/dirs/specifications/activesupport-3.0.pre.gemspec"
def
self
.
add_specs_to_loaded_specs
Gem
.
loaded_specs
.
merge!
@bundled_specs
end
def
self
.
add_specs_to_index
@bundled_specs
.
each
do
|
name
,
spec
|
Gem
.
source_index
.
add_spec
spec
end
end
add_specs_to_loaded_specs
add_specs_to_index
def
self
.
require_env
(
env
=
nil
)
context
=
Class
.
new
do
def
initialize
(
env
)
@env
=
env
&&
env
.
to_s
;
end
def
method_missing
(
*
)
;
end
def
only
(
env
)
old
,
@only
=
@only
,
_combine_onlys
(
env
)
yield
@only
=
old
end
def
except
(
env
)
old
,
@except
=
@except
,
_combine_excepts
(
env
)
yield
@except
=
old
end
def
gem
(
name
,
*
args
)
opt
=
args
.
last
||
{}
only
=
_combine_onlys
(
opt
[
:only
]
||
opt
[
"only"
])
except
=
_combine_excepts
(
opt
[
:except
]
||
opt
[
"except"
])
files
=
opt
[
:require_as
]
||
opt
[
"require_as"
]
||
name
return
unless
!
only
||
only
.
any?
{
|
e
|
e
==
@env
}
return
if
except
&&
except
.
any?
{
|
e
|
e
==
@env
}
files
.
each
{
|
f
|
require
f
}
yield
if
block_given?
true
end
private
def
_combine_onlys
(
only
)
return
@only
unless
only
only
=
[
only
].
flatten
.
compact
.
uniq
.
map
{
|
o
|
o
.
to_s
}
only
&=
@only
if
@only
only
end
def
_combine_excepts
(
except
)
return
@except
unless
except
except
=
[
except
].
flatten
.
compact
.
uniq
.
map
{
|
o
|
o
.
to_s
}
except
|=
@except
if
@except
except
end
end
context
.
new
(
env
&&
env
.
to_s
).
instance_eval
(
File
.
read
(
@gemfile
))
end
end
module
Gem
def
source_index
.
refresh!
super
Bundler
.
add_specs_to_index
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录