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

Included in:
Numeric
Defined in:
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/active_support/core_ext/numeric/bytes.rb', line 6

def bytes
  self
end

#gigabytesObject Also known as: gigabyte


21
22
23
# File '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/active_support/core_ext/numeric/bytes.rb', line 11

def kilobytes
  self * 1024
end

#megabytesObject Also known as: megabyte


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

def megabytes
  self * 1024.kilobytes
end

#terabytesObject Also known as: terabyte


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

def terabytes
  self * 1024.gigabytes
end