Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
Brakeman
提交
03448897
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 搜索 >>
提交
03448897
编写于
7月 26, 2012
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CSC] ErbTemplateProcessor
上级
0582705b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
lib/brakeman/processors/erb_template_processor.rb
lib/brakeman/processors/erb_template_processor.rb
+12
-12
未找到文件。
lib/brakeman/processors/erb_template_processor.rb
浏览文件 @
03448897
...
...
@@ -6,33 +6,33 @@ class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
#s(:call, TARGET, :method, s(:arglist))
def
process_call
exp
target
=
exp
[
1
]
target
=
exp
.
target
if
sexp?
target
target
=
process
target
end
method
=
exp
[
2
]
method
=
exp
.
method
#_erbout is the default output variable for erb
if
target
and
target
[
1
]
==
:_erbout
if
node_type?
target
,
:lvar
and
target
.
value
==
:_erbout
if
method
==
:concat
@inside_concat
=
true
args
=
exp
[
3
]
=
process
(
exp
[
3
]
)
args
=
exp
.
arglist
=
process
(
exp
.
arglist
)
@inside_concat
=
false
if
args
.
length
>
2
raise
Exception
.
new
(
"Did not expect more than a single argument to _erbout.concat"
)
end
arg
s
=
args
[
1
]
arg
=
args
[
1
]
if
arg
s
.
node_type
==
:call
and
args
[
2
]
==
:to_s
#erb always calls to_s on output
arg
s
=
args
[
1
]
if
arg
.
node_type
==
:call
and
arg
.
method
==
:to_s
#erb always calls to_s on output
arg
=
arg
.
target
end
if
arg
s
.
node_type
==
:str
#ignore plain strings
if
arg
.
node_type
==
:str
#ignore plain strings
ignore
else
s
=
Sexp
.
new
:output
,
arg
s
s
=
Sexp
.
new
:output
,
arg
s
.
line
(
exp
.
line
)
@current_template
[
:outputs
]
<<
s
s
...
...
@@ -43,11 +43,11 @@ class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
abort
"Unrecognized action on _erbout:
#{
method
}
"
end
elsif
target
==
nil
and
method
==
:render
exp
[
3
]
=
process
(
exp
[
3
]
)
exp
.
arglist
=
process
(
exp
.
arglist
)
make_render_in_view
exp
else
#TODO: Is it really necessary to create a new Sexp here?
args
=
exp
[
3
]
=
process
(
exp
[
3
]
)
args
=
exp
.
arglist
=
process
(
exp
.
arglist
)
call
=
Sexp
.
new
:call
,
target
,
method
,
args
call
.
original_line
(
exp
.
original_line
)
call
.
line
(
exp
.
line
)
...
...
@@ -70,7 +70,7 @@ class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
res
=
process
e
if
res
.
empty?
or
res
==
ignore
nil
elsif
node_type?
(
res
,
:lvar
)
and
res
[
1
]
==
:_erbout
elsif
node_type?
(
res
,
:lvar
)
and
res
.
value
==
:_erbout
nil
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录