Sha256: ea96a1b2610dd57f321f40ba90f8788630759b3f762b4964868913809425da22
Contents?: true
Size: 816 Bytes
Versions: 1
Compression:
Stored size: 816 Bytes
Contents
module Dag::CLI::Utils module NumberToHuman require 'active_support/number_helper/number_converter' require 'active_support/number_helper/number_to_delimited_converter' require 'active_support/number_helper/number_to_rounded_converter' require 'active_support/number_helper/number_to_human_size_converter' include ActiveSupport::NumberHelper I18n.enforce_available_locales = false def number_to_human(number, options = {}) NumberToHumanSizeConverter.new(number, options).execute end #{ # '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 "#{(num.to_f / (s / 1024)).round(2)} #{e}" if num < s } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iij-dag-1.0.1 | lib/dag/cli/utils/number_to_human.rb |