Skip to content
This repository
Browse code

Deprecation: remove deprecated human_size helper alias. Use number_to…

…_human_size instead.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6407 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 2823a56f14edac7e9012484d375f23c89405d725 1 parent b7107d0
Jeremy Kemper authored March 13, 2007
2  actionpack/CHANGELOG
... ...
@@ -1,6 +1,6 @@
1 1
 *SVN*
2 2
 
3  
-* Deprecation: remove deprecated request, redirect, and dependency methods.  Remove deprecated instance variables. Remove uses_component_template_root for toplevel components directory. Privatize deprecated render_partial and render_partial_collection view methods. Remove deprecated link_to_image and link_image_to helper methods.  [Jeremy Kemper]
  3
+* Deprecation: remove deprecated request, redirect, and dependency methods. Remove deprecated instance variables. Remove uses_component_template_root for toplevel components directory. Privatize deprecated render_partial and render_partial_collection view methods. Remove deprecated link_to_image and link_image_to helper methods. Remove deprecated human_size helper alias.  [Jeremy Kemper]
4 4
 
5 5
 * Consistent public/protected/private visibility for chained methods.  #7813 [Dan Manges]
6 6
 
21  actionpack/lib/action_view/helpers/number_helper.rb
@@ -50,7 +50,7 @@ def number_to_phone(number, options = {})
50 50
       #  number_to_currency(1234567890.50)     => $1,234,567,890.50
51 51
       #  number_to_currency(1234567890.506)    => $1,234,567,890.51
52 52
       #  number_to_currency(1234567890.506, :precision => 3)    => $1,234,567,890.506
53  
-      #  number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "") 
  53
+      #  number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "")
54 54
       #     => £1234567890,50
55 55
       def number_to_currency(number, options = {})
56 56
         options   = options.stringify_keys
@@ -58,7 +58,7 @@ def number_to_currency(number, options = {})
58 58
         unit      = options["unit"] || "$"
59 59
         separator = precision > 0 ? options["separator"] || "." : ""
60 60
         delimiter = options["delimiter"] || ","
61  
-        
  61
+
62 62
         begin
63 63
           parts = number_with_precision(number, precision).split('.')
64 64
           unit + number_with_delimiter(parts[0], delimiter) + separator + parts[1].to_s
@@ -79,7 +79,7 @@ def number_to_percentage(number, options = {})
79 79
         options   = options.stringify_keys
80 80
         precision = options["precision"] || 3
81 81
         separator = options["separator"] || "."
82  
-        
  82
+
83 83
         begin
84 84
           number = number_with_precision(number, precision)
85 85
           parts = number.split('.')
@@ -110,7 +110,7 @@ def number_with_delimiter(number, delimiter=",", separator=".")
110 110
           number
111 111
         end
112 112
       end
113  
-      
  113
+
114 114
       # Formats a +number+ with the specified level of +precision+. The default
115 115
       # level of precision is 3.
116 116
       #
@@ -121,12 +121,12 @@ def number_with_precision(number, precision=3)
121 121
       rescue
122 122
         number
123 123
       end
124  
-      
  124
+
125 125
       # Formats the bytes in +size+ into a more understandable representation.
126  
-      # Useful for reporting file sizes to users. This method returns nil if 
127  
-      # +size+ cannot be converted into a number. You can change the default 
  126
+      # Useful for reporting file sizes to users. This method returns nil if
  127
+      # +size+ cannot be converted into a number. You can change the default
128 128
       # precision of 1 in +precision+.
129  
-      # 
  129
+      #
130 130
       #  number_to_human_size(123)           => 123 Bytes
131 131
       #  number_to_human_size(1234)          => 1.2 KB
132 132
       #  number_to_human_size(12345)         => 12.1 KB
@@ -136,7 +136,7 @@ def number_with_precision(number, precision=3)
136 136
       #  number_to_human_size(1234567, 2)    => 1.18 MB
137 137
       def number_to_human_size(size, precision=1)
138 138
         size = Kernel.Float(size)
139  
-        case 
  139
+        case
140 140
           when size == 1        : "1 Byte"
141 141
           when size < 1.kilobyte: "%d Bytes" % size
142 142
           when size < 1.megabyte: "%.#{precision}f KB"  % (size / 1.0.kilobyte)
@@ -147,9 +147,6 @@ def number_to_human_size(size, precision=1)
147 147
       rescue
148 148
         nil
149 149
       end
150  
-      
151  
-      alias_method :human_size, :number_to_human_size # deprecated alias
152  
-      deprecate :human_size => :number_to_human_size
153 150
     end
154 151
   end
155 152
 end
6  actionpack/test/template/number_helper_test.rb
@@ -86,10 +86,4 @@ def test_number_to_human_size
86 86
     assert_nil number_to_human_size('x')
87 87
     assert_nil number_to_human_size(nil)
88 88
   end
89  
-  
90  
-  def test_human_size_alias_is_deprecated
91  
-    assert_deprecated 'human_size' do
92  
-      assert_equal '0 Bytes', human_size(0)
93  
-    end
94  
-  end
95 89
 end

0 notes on commit 2823a56

Please sign in to comment.
Something went wrong with that request. Please try again.