Module: PgExport::Roles::HumanReadable

Included in:
Dump
Defined in:
lib/pg_export/roles/human_readable.rb

Constant Summary collapse

MAPPING =
{
  'B'  => 1024,
  'kB' => 1024 * 1024,
  'MB' => 1024 * 1024 * 1024,
  'GB' => 1024 * 1024 * 1024 * 1024,
  'TB' => 1024 * 1024 * 1024 * 1024 * 1024
}.freeze

Instance Method Summary collapse

Instance Method Details

#size_humanObject



12
13
14
# File 'lib/pg_export/roles/human_readable.rb', line 12

def size_human
  MAPPING.each_pair { |e, s| return "#{(size.to_f / (s / 1024)).round(2)}#{e}" if size < s }
end