1
对不起,我不会使用英文的具体表达。如何纠正在Sinatra秀块
index.erb
<h1>Hello World.</h1>
<ul>
<li>item1</li>
<li>item2</li>
</ul>
<% capture_content :key do %>
I'm Here.
<% end %>
helpers
def capture_content(key, &block)
@content_hash = {}
@content_hash[key] = block.call # this block contains erb all
end
我只想capture_content
内容
我希望表达的是正确的T_T
你想达到什么目的? – gmaliar 2013-02-24 14:42:05
我想@content_hash [:key] ='我在这里' – kennx9 2013-02-24 14:46:53
也许Sinatra :: Contrib中的[Sinatra :: ContentFor](http://www.sinatrarb.com/contrib/content_for.html)你的需要? – nemesv 2013-02-24 14:58:51