public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/courtenay/rails.git
Added petabytes and exebytes to numeric extensions (closes #2397) 
[timct@mac.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2746 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Wed Oct 26 06:10:03 -0700 2005
commit  0d52abfd0ea42ba8f9bac996378087be42b93917
tree    645aaace243f83b00c0bc679534113d68126e273
parent  fabf34848eda7656f7a7f79647167e0fdd16f682
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Added petabytes and exebytes to numeric extensions #2397 [timct@mac.com]
0
+
0
 * Added Time#end_of_month to accompany Time#beginning_of_month #2514 [Jens-Christian Fischer]
0
 
0
 
...
27
28
29
 
 
 
 
 
 
 
 
 
 
 
30
31
32
...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
0
@@ -27,6 +27,17 @@ module ActiveSupport #:nodoc:
0
           self * 1024.gigabytes
0
         end
0
         alias :terabyte :terabytes
0
+
0
+ def petabytes
0
+ self * 1024.terabytes
0
+ end
0
+ alias :petabyte :petabytes
0
+
0
+ def exabytes
0
+ self * 1024.petabytes
0
+ end
0
+ alias :exabyte :exabytes
0
+
0
       end
0
     end
0
   end
...
46
47
48
49
 
 
 
50
51
52
...
46
47
48
 
49
50
51
52
53
54
0
@@ -46,7 +46,9 @@ class NumericExtSizeTest < Test::Unit::TestCase
0
       1.kilobyte ** 4 => 1.terabyte,
0
       1024.kilobytes + 2.megabytes => 3.megabytes,
0
                    2.gigabytes / 4 => 512.megabytes,
0
- 256.megabytes * 20 + 5.gigabytes => 10.gigabytes
0
+ 256.megabytes * 20 + 5.gigabytes => 10.gigabytes,
0
+ 1.kilobyte ** 5 => 1.petabyte,
0
+ 1.kilobyte ** 6 => 1.exabyte
0
     }
0
 
0
     relationships.each do |left, right|

Comments

    No one has commented yet.