Module: ActiveSupport::CoreExtensions::Numeric::Bytes
- Included in:
- Numeric
- Defined in:
- lib/action_controller/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)
- #gigabytes ⇒ Object (also: #gigabyte)
- #kilobytes ⇒ Object (also: #kilobyte)
- #megabytes ⇒ Object (also: #megabyte)
- #terabytes ⇒ Object (also: #terabyte)
Instance Method Details
#bytes ⇒ Object Also known as: byte
6 7 8 |
# File 'lib/action_controller/support/core_ext/numeric/bytes.rb', line 6 def bytes self end |
#gigabytes ⇒ Object Also known as: gigabyte
21 22 23 |
# File 'lib/action_controller/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/action_controller/support/core_ext/numeric/bytes.rb', line 11 def kilobytes self * 1024 end |
#megabytes ⇒ Object Also known as: megabyte
16 17 18 |
# File 'lib/action_controller/support/core_ext/numeric/bytes.rb', line 16 def megabytes self * 1024.kilobytes end |
#terabytes ⇒ Object Also known as: terabyte
26 27 28 |
# File 'lib/action_controller/support/core_ext/numeric/bytes.rb', line 26 def terabytes self * 1024.gigabytes end |