1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fixed documentation #1214

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1254 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-04-30 08:50:10 +00:00
parent 98306bed05
commit 90b08c5b92

View file

@ -51,9 +51,9 @@ module ActionView
# The +number+ can contain a level of precision using the +precision+ key; default is 3 # The +number+ can contain a level of precision using the +precision+ key; default is 3
# The unit separator can be set using the +separator+ key; default is "." # The unit separator can be set using the +separator+ key; default is "."
# Examples: # Examples:
# number_to_precision(100) => 100.000% # number_to_percentage(100) => 100.000%
# number_to_precision(100, {:precision => 0}) => 100% # number_to_percentage(100, {:precision => 0}) => 100%
# number_to_precision(302.0574, {:precision => 2}) => 302.06% # number_to_percentage(302.0574, {:precision => 2}) => 302.06%
def number_to_percentage(number, options = {}) def number_to_percentage(number, options = {})
options = options.stringify_keys options = options.stringify_keys
precision, separator = options.delete("precision") { 3 }, options.delete("separator") { "." } precision, separator = options.delete("precision") { 3 }, options.delete("separator") { "." }