lib/mongo_grid.rb in mongo_grid-0.1.0 vs lib/mongo_grid.rb in mongo_grid-0.1.1
- old
+ new
@@ -32,11 +32,13 @@
length=grid_data.chunk_size
file_size =
case length
when 0..1024**2
(length.to_f/1024.to_f).round(1).to_s+"K"
- when 1024**2..1024*1024*15
- (length.to_f/(1024*1024).to_f).round(1).to_s+"M"
+ when (1024**2)...(1024**3)
+ (length.to_f/(1024**2).to_f).round(1).to_s+"M"
+ when (1024**3)...(1024**4)
+ (length.to_f/(1024**3).to_f).round(1).to_s+"G"
end
hsh = {:grid_id=>gid.to_s,:filename=>filename,
:content_type=>content_type,:file_size=>file_size}
end