You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think having global options/config is appropriate for this gem.
If you want to standardise on the number of digits throughout your application you can use a helper. For example:
<%= percentage_format @change %>
That's the exact same approach as if you were using another numeric class like BigDecimal or Rational, or some other datatype where you need more than the implicit #to_s can provide (date, time, money etc).
You can also use the Rails helper, although it's more verbose:
Adding
.truncate(2)
after every call toPercentage.new
when displaying the information in a table is rather tedious.What are your thoughts on having an option to set truncation for future calls?
Something like the following would be nice and easy to implement.
When working with rails you could then create an initialiser
app/config/initializers/percentage.rb
to set this globally.The text was updated successfully, but these errors were encountered: