-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default formatter #3
Comments
For consistency, you might consider moving away from the def format_column(column_name, value)
case column_name.to_sym
when :month, :location then value.capitalize
when :weaksauce_secret then Base64.encode64(value)
else formatter.number_to_currency(value)
end
end |
In some reports I've been moving the other way and doing a |
Though it would be nice to do def format_column(name, value)
case name.to_sym
when :amount, :tax, :subtotal
formatter.number_to_currency(value)
else
value
end
end One important thing to remember is that a default formatter like this would need to always return a value... |
True. It would be helpful to raise an exception if it didn't. |
The problem with that, is that sometimes you might not want it to return a value intentionally. Sent from my iPhone On Jun 14, 2013, at 1:48 PM, Nathan Long [email protected] wrote:
|
Because you want the column to be blank? In that case, you could return an empty string; the exception would be raised if you returned nil. |
Good point, returning |
It would be nice to have a
format_default
method that, if defined, can be called to format columns. That may not be the best name as we'll have to avoid naming conflicts with column names.The text was updated successfully, but these errors were encountered: