From 0ee1cb2cd32bfaf47deaf5440dd5b9cf0915ab6a Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 2 Oct 2007 05:32:14 +0000 Subject: Ruby 1.9 compat, consistent load paths git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7719 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/number_helper.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_view/helpers/number_helper.rb') diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 64e424df2f..0b76f1a48f 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -164,11 +164,11 @@ module ActionView def number_to_human_size(size, precision=1) size = Kernel.Float(size) case - when size.to_i == 1 : "1 Byte" - when size < 1.kilobyte: "%d Bytes" % size - when size < 1.megabyte: "%.#{precision}f KB" % (size / 1.0.kilobyte) - when size < 1.gigabyte: "%.#{precision}f MB" % (size / 1.0.megabyte) - when size < 1.terabyte: "%.#{precision}f GB" % (size / 1.0.gigabyte) + when size.to_i == 1; "1 Byte" + when size < 1.kilobyte; "%d Bytes" % size + when size < 1.megabyte; "%.#{precision}f KB" % (size / 1.0.kilobyte) + when size < 1.gigabyte; "%.#{precision}f MB" % (size / 1.0.megabyte) + when size < 1.terabyte; "%.#{precision}f GB" % (size / 1.0.gigabyte) else "%.#{precision}f TB" % (size / 1.0.terabyte) end.sub(/([0-9])\.?0+ /, '\1 ' ) rescue -- cgit v1.2.3