Class: SizeConverter::Human
- Inherits:
-
Object
- Object
- SizeConverter::Human
- Defined in:
- lib/riel/size_converter.rb
Constant Summary collapse
- CONVERSIONS =
[ [ 12, "T" ], [ 9, "G" ], [ 6, "M" ], [ 3, "K" ] ]
Class Method Summary collapse
-
.convert(size, decimal_places = 1) ⇒ Object
returns a string representation of the size.
Class Method Details
.convert(size, decimal_places = 1) ⇒ Object
returns a string representation of the size. Note that K, G, M are gibibytes, etc., that is, powers of 10.
23 24 25 |
# File 'lib/riel/size_converter.rb', line 23 def self.convert size, decimal_places = 1 SizeConverter._convert CONVERSIONS, 10, size, decimal_places end |