There are a couple of ways you can pad the positive numbers with a little bit of space, either:
- Use a fixed width font and a nonbreaking space
- Apply a class to the enclosing element of your positive numbers (or wrap in a span) and then use internal padding to add space to the right.
The first approach mixes presentation with content, but has the advantage of working with any font size (or user resized fonts). With the second solution your HTML is cleaner and in well-behaved browsers things will work well, but your mileage will vary with less modern ones.
Here's a quick implementation of the first option:
def pad_positives(number_string)
unless number_string[0,1] == '('
number_string += '%nbsp;'
end
number_string
end
You could drop this in your appropriate helper file and then do something like this in your view:
<%= pad_positives(number_to_currency(number, ...)) %>
Note this function expects a string, so it will choke if you pass it a number. Hope this helps!