Module: PassiveSupport::CoreExtensions::Numeric::Bytes

Included in:
Numeric
Defined in:
lib/passive_support/core_ext/numeric/bytes.rb

Overview

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

Constant Summary collapse

KILOBYTE =
1024
MEGABYTE =
KILOBYTE * 1024
GIGABYTE =
MEGABYTE * 1024
TERABYTE =
GIGABYTE * 1024
PETABYTE =
TERABYTE * 1024
EXABYTE =
PETABYTE * 1024

Instance Method Summary collapse

Instance Method Details

#bytesObject Also known as: byte



13
14
15
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 13

def bytes
  self
end

#exabytesObject Also known as: exabyte



43
44
45
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 43

def exabytes
  self * EXABYTE
end

#gigabytesObject Also known as: gigabyte



28
29
30
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 28

def gigabytes
  self * GIGABYTE
end

#kilobytesObject Also known as: kilobyte



18
19
20
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 18

def kilobytes
  self * KILOBYTE
end

#megabytesObject Also known as: megabyte



23
24
25
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 23

def megabytes
  self * MEGABYTE
end

#petabytesObject Also known as: petabyte



38
39
40
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 38

def petabytes
  self * PETABYTE
end

#terabytesObject Also known as: terabyte



33
34
35
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 33

def terabytes
  self * TERABYTE
end