有没有办法在 Slim 中为以下示例编写 case 语句。我对 StackOverflow 问题做了一些更改:How to write a switch statement in Ruby
case a
when 1..5
= "It's between 1 and 5"
when 6
= "It's 6"
when String
= "You passed a string"
else
= "You gave me #{a} -- I have no idea what to do with that."
end
我尝试了以下但产生错误。
= case @taxon.name
= when "Wedding Cakes"
div.taxon-descripiton Wedding Cake Description
这就是我被告知的
... syntax error, unexpected tIVAR, expecting keyword_when
; @output_buffer.safe_concat(("<when>\"Weddin...