# File lib/dister/utils.rb, line 42 def readable_file_size(size, precision) case when size == 1 then "1 Byte" when size < KILO_SIZE then "%d Bytes" % size when size < MEGA_SIZE then "%.#{precision}f KB" % (size / KILO_SIZE) when size < GIGA_SIZE then "%.#{precision}f MB" % (size / MEGA_SIZE) else "%.#{precision}f GB" % (size / GIGA_SIZE) end end