# File lib/facet/numeric/octet_units.rb, line 18 def octet_units(fmt='%.2f') case when self < 1.kilobyte "#{self} bytes" when self < 1.megabyte "#{fmt % (self.to_f / 1.kilobyte)} KB" when self < 1.gigabyte "#{fmt % (self.to_f / 1.megabyte)} MB" when self < 1.terabyte "#{fmt % (self.to_f / 1.gigabyte)} GB" else "#{fmt % (self.to_f / 1.terabyte)} TB" end end