class Numeric

Constants

EXABYTE
GIGABYTE
KILOBYTE
MEGABYTE
PETABYTE
TERABYTE

Public Instance Methods

byte()
Alias for: bytes
bytes() click to toggle source

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

2.bytes # => 2
# File lib/simple_ext/numeric/bytes.rb, line 14
def bytes
  self
end
Also aliased as: byte
exabyte()
Alias for: exabytes
exabytes() click to toggle source

Returns the number of bytes equivalent to the exabytes provided.

2.exabytes # => 2_305_843_009_213_693_952
# File lib/simple_ext/numeric/bytes.rb, line 62
def exabytes
  self * EXABYTE
end
Also aliased as: exabyte
gigabyte()
Alias for: gigabytes
gigabytes() click to toggle source

Returns the number of bytes equivalent to the gigabytes provided.

2.gigabytes # => 2_147_483_648
# File lib/simple_ext/numeric/bytes.rb, line 38
def gigabytes
  self * GIGABYTE
end
Also aliased as: gigabyte
kilobyte()
Alias for: kilobytes
kilobytes() click to toggle source

Returns the number of bytes equivalent to the kilobytes provided.

2.kilobytes # => 2048
# File lib/simple_ext/numeric/bytes.rb, line 22
def kilobytes
  self * KILOBYTE
end
Also aliased as: kilobyte
megabyte()
Alias for: megabytes
megabytes() click to toggle source

Returns the number of bytes equivalent to the megabytes provided.

2.megabytes # => 2_097_152
# File lib/simple_ext/numeric/bytes.rb, line 30
def megabytes
  self * MEGABYTE
end
Also aliased as: megabyte
petabyte()
Alias for: petabytes
petabytes() click to toggle source

Returns the number of bytes equivalent to the petabytes provided.

2.petabytes # => 2_251_799_813_685_248
# File lib/simple_ext/numeric/bytes.rb, line 54
def petabytes
  self * PETABYTE
end
Also aliased as: petabyte
terabyte()
Alias for: terabytes
terabytes() click to toggle source

Returns the number of bytes equivalent to the terabytes provided.

2.terabytes # => 2_199_023_255_552
# File lib/simple_ext/numeric/bytes.rb, line 46
def terabytes
  self * TERABYTE
end
Also aliased as: terabyte