Sha256: 15bc39d9c7c19ff41cb65b8433855e2e2ac5e9029c782ee71a82f7d604dc8880
Contents?: true
Size: 344 Bytes
Versions: 11
Compression:
Stored size: 344 Bytes
Contents
class Integer def to_human_readable n = self if n < 1024 return "#{n} B" elsif n >= 1024 and n < 1024*1024 return "%.1f KB" % (n.to_f / 1024) elsif n >= 1024*1024 and n < 1024*1024*1024 return "%.1f MB" % (n.to_f / (1024*1024)) else return "%.1f GB" % (n.to_f / (1024*1024*1024)) end end end
Version data entries
11 entries across 11 versions & 2 rubygems