module Dust

Constants

VERSION

Public Class Methods

convert_size(s) click to toggle source

converts string to kilobytes (rounded)

# File lib/dust/helper.rb, line 79
def self.convert_size s
  i, unit = s.split(' ')

  case unit.downcase
  when 'kb'
    return i.to_i
  when 'mb'
    return (i.to_f * 1024).to_i
  when 'gb'
    return (i.to_f * 1024 * 1024).to_i
  when 'tb'
    return (i.to_f * 1024 * 1024 * 1024).to_i
  else
    return false
  end
end