Sha256: b6cda858439767b4c75b75c447f1c1fb90732bd406486f6b141b0ef733f44743
Contents?: true
Size: 452 Bytes
Versions: 4
Compression:
Stored size: 452 Bytes
Contents
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. class Numeric FILESIZE_FORMAT = [ ['%.1fT', 1 << 40], ['%.1fG', 1 << 30], ['%.1fM', 1 << 20], ['%.1fK', 1 << 10], ] def filesize_format FILESIZE_FORMAT.each do |format, size| return format % (self.to_f / size) if self >= size end self.to_s end end
Version data entries
4 entries across 4 versions & 1 rubygems