Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
Brakeman
提交
9488b127
B
Brakeman
项目概览
李少辉-开发者
/
Brakeman
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
Brakeman
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9488b127
编写于
8月 24, 2012
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change "caller" of rendered templates to an array
instead of a single caller
上级
927af46a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
8 deletion
+12
-8
lib/brakeman/processor.rb
lib/brakeman/processor.rb
+1
-1
lib/brakeman/processors/controller_alias_processor.rb
lib/brakeman/processors/controller_alias_processor.rb
+1
-1
lib/brakeman/processors/template_alias_processor.rb
lib/brakeman/processors/template_alias_processor.rb
+9
-5
lib/brakeman/warning.rb
lib/brakeman/warning.rb
+1
-1
未找到文件。
lib/brakeman/processor.rb
浏览文件 @
9488b127
...
...
@@ -72,7 +72,7 @@ module Brakeman
#Each template which is rendered is stored separately
#with a new name.
if
called_from
name
=
(
name
.
to_s
+
"."
+
called_from
.
to_s
).
to_sym
name
=
(
"
#{
name
}
.
#{
called_from
}
"
).
to_sym
end
@tracker
.
templates
[
name
][
:src
]
=
result
...
...
lib/brakeman/processors/controller_alias_processor.rb
浏览文件 @
9488b127
...
...
@@ -168,7 +168,7 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
#Process template and add the current class and method name as called_from info
def
process_template
name
,
args
super
name
,
args
,
"
#@current_class
#
#@current_method
"
super
name
,
args
,
[
"
#@current_class
#
#@current_method
"
]
end
#Turns a method name into a template name
...
...
lib/brakeman/processors/template_alias_processor.rb
浏览文件 @
9488b127
...
...
@@ -17,12 +17,16 @@ class Brakeman::TemplateAliasProcessor < Brakeman::AliasProcessor
#Process template
def
process_template
name
,
args
if
@called_from
and
@called_from
.
match
(
/Template:
#{
name
}
$/
)
Brakeman
.
debug
"Skipping circular render from
#{
@template
[
:name
]
}
to
#{
name
}
"
return
end
if
@called_from
unless
@called_from
.
grep
(
/Template:
#{
name
}
$/
).
empty?
Brakeman
.
debug
"Skipping circular render from
#{
@template
[
:name
]
}
to
#{
name
}
"
return
end
super
name
,
args
,
"Template:
#{
@template
[
:name
]
}
"
super
name
,
args
,
@called_from
+
[
"Template:
#{
@template
[
:name
]
}
"
]
else
super
name
,
args
,
[
"Template:
#{
@template
[
:name
]
}
"
]
end
end
#Determine template name
...
...
lib/brakeman/warning.rb
浏览文件 @
9488b127
...
...
@@ -66,7 +66,7 @@ class Brakeman::Warning
def
view_name
return
@view_name
if
@view_name
if
called_from
@view_name
=
"
#{
template
[
:name
]
}
(
#{
called_from
}
)"
@view_name
=
"
#{
template
[
:name
]
}
(
#{
called_from
.
last
}
)"
else
@view_name
=
template
[
:name
]
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录