Class: Numeric
- Defined in:
- lib/simple_ext/object/blank.rb,
lib/simple_ext/numeric/bytes.rb
Overview
:nodoc:
Constant Summary collapse
- KILOBYTE =
1024
- MEGABYTE =
KILOBYTE * 1024
- GIGABYTE =
MEGABYTE * 1024
- TERABYTE =
GIGABYTE * 1024
- PETABYTE =
TERABYTE * 1024
- EXABYTE =
PETABYTE * 1024
Instance Method Summary collapse
-
#blank? ⇒ false
No number is blank:.
-
#bytes ⇒ Object
(also: #byte)
Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes.
-
#exabytes ⇒ Object
(also: #exabyte)
Returns the number of bytes equivalent to the exabytes provided.
-
#gigabytes ⇒ Object
(also: #gigabyte)
Returns the number of bytes equivalent to the gigabytes provided.
-
#kilobytes ⇒ Object
(also: #kilobyte)
Returns the number of bytes equivalent to the kilobytes provided.
-
#megabytes ⇒ Object
(also: #megabyte)
Returns the number of bytes equivalent to the megabytes provided.
-
#petabytes ⇒ Object
(also: #petabyte)
Returns the number of bytes equivalent to the petabytes provided.
-
#terabytes ⇒ Object
(also: #terabyte)
Returns the number of bytes equivalent to the terabytes provided.
Instance Method Details
#blank? ⇒ false
No number is blank:
1.blank? # => false
0.blank? # => false
140 141 142 |
# File 'lib/simple_ext/object/blank.rb', line 140 def blank? false end |
#bytes ⇒ Object Also known as: byte
Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
2.bytes # => 2
14 15 16 |
# File 'lib/simple_ext/numeric/bytes.rb', line 14 def bytes self end |
#exabytes ⇒ Object Also known as: exabyte
Returns the number of bytes equivalent to the exabytes provided.
2.exabytes # => 2_305_843_009_213_693_952
62 63 64 |
# File 'lib/simple_ext/numeric/bytes.rb', line 62 def exabytes self * EXABYTE end |
#gigabytes ⇒ Object Also known as: gigabyte
Returns the number of bytes equivalent to the gigabytes provided.
2.gigabytes # => 2_147_483_648
38 39 40 |
# File 'lib/simple_ext/numeric/bytes.rb', line 38 def gigabytes self * GIGABYTE end |
#kilobytes ⇒ Object Also known as: kilobyte
Returns the number of bytes equivalent to the kilobytes provided.
2.kilobytes # => 2048
22 23 24 |
# File 'lib/simple_ext/numeric/bytes.rb', line 22 def kilobytes self * KILOBYTE end |
#megabytes ⇒ Object Also known as: megabyte
Returns the number of bytes equivalent to the megabytes provided.
2.megabytes # => 2_097_152
30 31 32 |
# File 'lib/simple_ext/numeric/bytes.rb', line 30 def megabytes self * MEGABYTE end |