aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/number_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-07-05 01:04:32 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-07-05 01:04:32 +0000
commit532627452d0e581eb263499ccf84cf92f27de4d8 (patch)
tree9d8365a22d065435237cf85938850eb7b9645851 /actionpack/lib/action_view/helpers/number_helper.rb
parent4bd827e5230182d4b942af265b1e256d09469e31 (diff)
downloadrails-532627452d0e581eb263499ccf84cf92f27de4d8.tar.gz
rails-532627452d0e581eb263499ccf84cf92f27de4d8.tar.bz2
rails-532627452d0e581eb263499ccf84cf92f27de4d8.zip
Added special case for "1 Byte" in NumberHelper#number_to_human_size (closes #5593) [murpyh@rubychan.de]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4537 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/number_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/number_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb
index 9098dd8c33..cb312320ef 100644
--- a/actionpack/lib/action_view/helpers/number_helper.rb
+++ b/actionpack/lib/action_view/helpers/number_helper.rb
@@ -3,7 +3,6 @@ module ActionView
# Provides methods for converting a number into a formatted string that currently represents
# one of the following forms: phone number, percentage, money, or precision level.
module NumberHelper
-
# Formats a +number+ into a US phone number string. The +options+ can be a hash used to customize the format of the output.
# The area code can be surrounded by parentheses by setting +:area_code+ to true; default is false
# The delimiter can be set using +:delimiter+; default is "-"
@@ -86,6 +85,7 @@ module ActionView
# human_size(1234567890) => 1.1 GB
def number_to_human_size(size)
case
+ when size == 1 : '1 Byte'
when size < 1.kilobyte: '%d Bytes' % size
when size < 1.megabyte: '%.1f KB' % (size / 1.0.kilobyte)
when size < 1.gigabyte: '%.1f MB' % (size / 1.0.megabyte)