Sha256: 624261d197366e817f5852b090b74eeeb77474dbd6b6b0df0fdc1ec4af064299

Contents?: true

Size: 390 Bytes

Versions: 1

Compression:

Stored size: 390 Bytes

Contents

class PgExport
  class Dump
    module SizeHuman
      def size_human
        {
          'B'  => 1024,
          'kB' => 1024 * 1024,
          'MB' => 1024 * 1024 * 1024,
          'GB' => 1024 * 1024 * 1024 * 1024,
          'TB' => 1024 * 1024 * 1024 * 1024 * 1024
        }.each_pair { |e, s| return "#{(size.to_f / (s / 1024)).round(2)}#{e}" if size < s }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pg_export-0.5.1 lib/pg_export/includable_modules/dump/size_human.rb