概要
bytes
詳細
bytes について
bytes
数値を単位ごとのバイト数に変換する。
・bytes
・kilobytes
・megabytes
・gigabytes
・terabytes
・petabytes
・exabytes
サンプル
# encoding: utf-8 require 'active_support/core_ext/numeric/bytes' require 'tbpgr_utils' bulk_puts_eval binding, <<-EOS 2.kilobytes 2.megabytes 2.gigabytes 2.terabytes 2.petabytes 2.exabytes EOS __END__ ・下記はTbpgrUtils gemの機能 bulk_puts_eval https://rubygems.org/gems/tbpgr_utils https://github.com/tbpgr/tbpgr_utils
出力
2.kilobytes # => 2048 2.megabytes # => 2097152 2.gigabytes # => 2147483648 2.terabytes # => 2199023255552 2.petabytes # => 2251799813685248 2.exabytes # => 2305843009213693952