lib/onebox/helpers.rb in onebox-1.8.68 vs lib/onebox/helpers.rb in onebox-1.8.69

- old
+ new

@@ -1,9 +1,9 @@ module Onebox module Helpers - class DownloadTooLarge < StandardError; end; + class DownloadTooLarge < StandardError; end def self.symbolize_keys(hash) return {} if hash.nil? hash.inject({}) do |result, (key, value)| @@ -135,11 +135,11 @@ end end end def self.pretty_filesize(size) - conv = [ 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB' ]; - scale = 1024; + conv = [ 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB' ] + scale = 1024 ndx = 1 if (size < 2 * (scale**ndx)) then return "#{(size)} #{conv[ndx - 1]}" end