gpt4 book ai didi

ruby-on-rails - 停止阅读 erb

转载 作者:太空宇宙 更新时间:2023-11-03 17:57:57 24 4
gpt4 key购买 nike

在 ruby​​ 的 ERB 中(例如在 rails View 中)有没有办法在到达结尾之前停止解析文件?与 ruby​​ 的 __END__ 方向一致。

Some Text
<%= ... %>
<% some_magic_quit_function %>
This will not be included in the result

我试过 return 但它没有正常工作。

最佳答案

没有,但是有更直接的

<% unless some_quit_function %>
Output you don't want included if some_quit_function returns true
<% end %>

关于ruby-on-rails - 停止阅读 erb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10154360/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com