From 1497522ab0b84f39a04774b4a6a86dea32aa9a3e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 11 Jan 2005 22:06:05 +0000 Subject: Fixed the half applied 393 changeset git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@395 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/core_ext/numeric/bytes.rb | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 activesupport/lib/core_ext/numeric/bytes.rb (limited to 'activesupport/lib/core_ext/numeric/bytes.rb') diff --git a/activesupport/lib/core_ext/numeric/bytes.rb b/activesupport/lib/core_ext/numeric/bytes.rb new file mode 100644 index 0000000000..59846ff37e --- /dev/null +++ b/activesupport/lib/core_ext/numeric/bytes.rb @@ -0,0 +1,33 @@ +module ActiveSupport + module CoreExtensions + module Numeric + module Bytes + + def bytes + self + end + alias :byte :bytes + + def kilobytes + self * 1024 + end + alias :kilobyte :kilobytes + + def megabytes + self * 1024.kilobytes + end + alias :megabyte :megabytes + + def gigabytes + self * 1024.megabytes + end + alias :gigabyte :gigabytes + + def terabytes + self * 1024.gigabytes + end + alias :terabyte :terabytes + end + end + end +end -- cgit v1.2.3