Module: ActiveSupport::CoreExtensions::Numeric::Bytes
- Included in:
- Numeric
- Defined in:
- lib/active_support/core_ext/numeric/bytes.rb
Overview
Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
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
6 7 8 |
# File 'lib/active_support/core_ext/numeric/bytes.rb', line 6 def bytes self end |
#exabytes ⇒ Object Also known as: exabyte
36 37 38 |
# File 'lib/active_support/core_ext/numeric/bytes.rb', line 36 def exabytes self * 1024.petabytes end |
#gigabytes ⇒ Object Also known as: gigabyte
21 22 23 |
# File 'lib/active_support/core_ext/numeric/bytes.rb', line 21 def gigabytes self * 1024.megabytes end |
#kilobytes ⇒ Object Also known as: kilobyte
11 12 13 |
# File 'lib/active_support/core_ext/numeric/bytes.rb', line 11 def kilobytes self * 1024 end |
#megabytes ⇒ Object Also known as: megabyte
16 17 18 |
# File 'lib/active_support/core_ext/numeric/bytes.rb', line 16 def megabytes self * 1024.kilobytes end |
#petabytes ⇒ Object Also known as: petabyte
31 32 33 |
# File 'lib/active_support/core_ext/numeric/bytes.rb', line 31 def petabytes self * 1024.terabytes end |
#terabytes ⇒ Object Also known as: terabyte
26 27 28 |
# File 'lib/active_support/core_ext/numeric/bytes.rb', line 26 def terabytes self * 1024.gigabytes end |