lib/onebox/helpers.rb in onebox-1.8.1 vs lib/onebox/helpers.rb in onebox-1.8.2

- old
+ new

@@ -1,9 +1,9 @@ module Onebox module Helpers - class DownloadTooLarge < Exception; end; + class DownloadTooLarge < StandardError; end; def self.symbolize_keys(hash) return {} if hash.nil? hash.inject({}){|result, (key, value)| @@ -95,12 +95,12 @@ ndx=1 if( size < 2*(scale**ndx) ) then return "#{(size)} #{conv[ndx-1]}" end size=size.to_f - [2,3,4,5,6,7].each do |ndx| - if( size < 2*(scale**ndx) ) then - return "#{'%.2f' % (size/(scale**(ndx-1)))} #{conv[ndx-1]}" + [2,3,4,5,6,7].each do |i| + if (size < 2*(scale**i)) then + return "#{'%.2f' % (size/(scale**(i-1)))} #{conv[i-1]}" end end ndx=7 return "#{'%.2f' % (size/(scale**(ndx-1)))} #{conv[ndx-1]}" end