Created
November 30, 2012 01:03
-
-
Save rroblak/4173047 to your computer and use it in GitHub Desktop.
ruby rails NumberHelper#decimal_to_round_percentage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module NumberHelper | |
def decimal_to_round_percentage(decimal) | |
begin | |
"#{(decimal * 100).round}%" | |
rescue FloatDomainError => e | |
"∞" | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module NumberHelper | |
def decimal_to_round_percentage(decimal) | |
begin | |
"#{(decimal * 100).round}%" | |
rescue FloatDomainError => e | |
"∞" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment