Module: ActiveSupport::CoreExtensions::Numeric::Bytes

Included in:
Numeric
Defined in:
lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb

Overview

Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes

Instance Method Summary collapse

Instance Method Details

#bytesObject Also known as: byte



6
7
8
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb', line 6

def bytes
  self
end

#exabytesObject Also known as: exabyte



36
37
38
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb', line 36

def exabytes
  self * 1024.petabytes
end

#gigabytesObject Also known as: gigabyte



21
22
23
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb', line 21

def gigabytes
  self * 1024.megabytes 
end

#kilobytesObject Also known as: kilobyte



11
12
13
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb', line 11

def kilobytes
  self * 1024
end

#megabytesObject Also known as: megabyte



16
17
18
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb', line 16

def megabytes
  self * 1024.kilobytes
end

#petabytesObject Also known as: petabyte



31
32
33
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb', line 31

def petabytes
  self * 1024.terabytes
end

#terabytesObject Also known as: terabyte



26
27
28
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb', line 26

def terabytes
  self * 1024.gigabytes
end