Module: Slapp::Helpers
Instance Method Summary collapse
Instance Method Details
#convert_to_bytes(string) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/slapp/helpers.rb', line 3 def convert_to_bytes(string) units = { :'K' => 1024, :'MB' => 1024 * 1024 } formula = units.map {|u| u.last if string.include? u.first.to_s }.compact string.to_i * formula.first end |