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
- #bytes ⇒ Object (also: #byte)
- #exabytes ⇒ Object (also: #exabyte)
- #gigabytes ⇒ Object (also: #gigabyte)
- #kilobytes ⇒ Object (also: #kilobyte)
- #megabytes ⇒ Object (also: #megabyte)
- #petabytes ⇒ Object (also: #petabyte)
- #terabytes ⇒ Object (also: #terabyte)
Instance Method Details
#bytes ⇒ Object Also known as: byte
13 14 15 |
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 13 def bytes self end |
#exabytes ⇒ Object Also known as: exabyte
43 44 45 |
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 43 def exabytes self * EXABYTE end |
#gigabytes ⇒ Object Also known as: gigabyte
28 29 30 |
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 28 def gigabytes self * GIGABYTE end |
#kilobytes ⇒ Object Also known as: kilobyte
18 19 20 |
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 18 def kilobytes self * KILOBYTE end |
#megabytes ⇒ Object Also known as: megabyte
23 24 25 |
# File 'lib/passive_support/core_ext/numeric/bytes.rb', line 23 def megabytes self * MEGABYTE end |