阅读背景:

有没有办法限制ERB (Ruby)中的变量范围?

来源:互联网 

Currently I can do:

目前我能做的:

r = ERB.new('Hi there <%= name %>')
r.result(OpenStruct.new(name: 'Joan').instance_eval{ binding })
# Outputs 'Hi there Joan'
r = ERB.new('Hi



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: