Domanda

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.

È stato utile?

Soluzione

Another approach, tested, should work:

= "=" * 10

Altri suggerimenti

This should work

- 10.times do
  &= "="
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top