class Numeric
Constants
- EXABYTE
- GIGABYTE
- KILOBYTE
- MEGABYTE
- PETABYTE
- TERABYTE
Public Instance Methods
bytes()
click to toggle source
Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
2.bytes # => 2
# File lib/core_ext/numeric_bytes.rb, line 40 def bytes self end
Also aliased as: byte
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/core_ext/numeric_bytes.rb, line 88 def exabytes self * EXABYTE end
Also aliased as: exabyte
gigabytes()
click to toggle source
Returns the number of bytes equivalent to the gigabytes provided.
2.gigabytes # => 2_147_483_648
# File lib/core_ext/numeric_bytes.rb, line 64 def gigabytes self * GIGABYTE end
Also aliased as: gigabyte
kilobytes()
click to toggle source
Returns the number of bytes equivalent to the kilobytes provided.
2.kilobytes # => 2048
# File lib/core_ext/numeric_bytes.rb, line 48 def kilobytes self * KILOBYTE end
Also aliased as: kilobyte
megabytes()
click to toggle source
Returns the number of bytes equivalent to the megabytes provided.
2.megabytes # => 2_097_152
# File lib/core_ext/numeric_bytes.rb, line 56 def megabytes self * MEGABYTE end
Also aliased as: megabyte
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/core_ext/numeric_bytes.rb, line 80 def petabytes self * PETABYTE end
Also aliased as: petabyte
terabytes()
click to toggle source
Returns the number of bytes equivalent to the terabytes provided.
2.terabytes # => 2_199_023_255_552
# File lib/core_ext/numeric_bytes.rb, line 72 def terabytes self * TERABYTE end
Also aliased as: terabyte