Class: SizeConverter::SI

Inherits:
Object
  • Object
show all
Defined in:
lib/riel/size_converter.rb

Constant Summary collapse

CONVERSIONS =
[ 
  [ 40, "TiB" ],
  [ 30, "GiB" ],
  [ 20, "MiB" ],
  [ 10, "KiB" ]
]

Class Method Summary collapse

Class Method Details

.convert(size, decimal_places = 1) ⇒ Object

returns a string representation of the size. Note that K, G, M are gigabytes, etc.



40
41
42
# File 'lib/riel/size_converter.rb', line 40

def self.convert size, decimal_places = 1
  SizeConverter._convert CONVERSIONS, 2, size, decimal_places
end