In Rails with HAML, I want to create a simple line of spaces: ====== on the page, with variable length. However, the following code:

- 10.times do
  \=

renders the following:

= = = = = = = = = =

I want to get rid of the spaces in the middle of these equals signs, but I don't really have any idea how. I know with ERB you can use

<%= 10.times do -%>=<% end %>

but I'm having trouble figuring out how to do it here.

有帮助吗?

解决方案

Another approach, tested, should work:

= "=" * 10

其他提示

This should work

- 10.times do
  &= "="
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top