Skip to content

Commit

Permalink
ruby1.9 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ricciardi committed Oct 30, 2010
1 parent 399fd20 commit adffdf5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/sinatra-s3/helpers/admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ def login_required

def number_to_human_size(size)
case
when size < 1.kilobyte: '%d Bytes' % size
when size < 1.megabyte: '%.1f KB' % (size / 1.0.kilobyte)
when size < 1.gigabyte: '%.1f MB' % (size / 1.0.megabyte)
when size < 1.terabyte: '%.1f GB' % (size / 1.0.gigabyte)
when size < 1.kilobyte then '%d Bytes' % size
when size < 1.megabyte then '%.1f KB' % (size / 1.0.kilobyte)
when size < 1.gigabyte then '%.1f MB' % (size / 1.0.megabyte)
when size < 1.terabyte then '%.1f GB' % (size / 1.0.gigabyte)
else '%.1f TB' % (size / 1.0.terabyte)
end.sub('.0', '')
rescue
Expand Down
6 changes: 5 additions & 1 deletion lib/sinatra-s3/s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
require 'openssl'
require 'base64'
require 'digest/sha1'
require 'md5'
if RUBY_VERSION < '1.9'
require 'md5'
else
require 'digest/md5'
end
require 'haml'

begin
Expand Down

0 comments on commit adffdf5

Please sign in to comment.