mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Added petabytes and exebytes to numeric extensions #2397 [timct@mac.com]
|
||||
|
||||
* Added Time#end_of_month to accompany Time#beginning_of_month #2514 [Jens-Christian Fischer]
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,17 @@ module ActiveSupport #:nodoc:
|
||||
self * 1024.gigabytes
|
||||
end
|
||||
alias :terabyte :terabytes
|
||||
|
||||
def petabytes
|
||||
self * 1024.terabytes
|
||||
end
|
||||
alias :petabyte :petabytes
|
||||
|
||||
def exabytes
|
||||
self * 1024.petabytes
|
||||
end
|
||||
alias :exabyte :exabytes
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -46,7 +46,9 @@ class NumericExtSizeTest < Test::Unit::TestCase
|
||||
1.kilobyte ** 4 => 1.terabyte,
|
||||
1024.kilobytes + 2.megabytes => 3.megabytes,
|
||||
2.gigabytes / 4 => 512.megabytes,
|
||||
256.megabytes * 20 + 5.gigabytes => 10.gigabytes
|
||||
256.megabytes * 20 + 5.gigabytes => 10.gigabytes,
|
||||
1.kilobyte ** 5 => 1.petabyte,
|
||||
1.kilobyte ** 6 => 1.exabyte
|
||||
}
|
||||
|
||||
relationships.each do |left, right|
|
||||
|
||||
Reference in New Issue
Block a user