Sha256: 8b47e7f4b80e27c10c5d06c4ddcbeb19d390056552f33b6bc6bef3844c4fd34c
Contents?: true
Size: 339 Bytes
Versions: 12
Compression:
Stored size: 339 Bytes
Contents
# -*- encoding : utf-8 -*- module RademadeAdmin class FileInfoFormatter def self.format_size(size) units = %w(B KB MB GB TB) digit_groups = (Math.log10(size) / Math.log10(1024)).to_i formatted_value = size.to_f / (1024 ** digit_groups) '%.2f' % formatted_value + ' ' + units[digit_groups] end end end
Version data entries
12 entries across 12 versions & 1 rubygems