module PackerFiles::Utils::Size

Contains utility functions to manage size conversions

Public Instance Methods

Bytes(size) click to toggle source

Convert MiB Size into Bytes

# File lib/PackerFiles/Utils/Size.rb, line 36
def Bytes(size)
   size * 1024 * 1024
end
MiB(size) click to toggle source

Convert a text 'size' into a units of MiB. This is done calling the appropriate lambda function, whenever the regex is matched.

# File lib/PackerFiles/Utils/Size.rb, line 27
def MiB(size)
   @@regex.each_pair do |r, l|
      if m = r.match(size)
         return l.call(m[1].to_i)
      end
   end
end