Module: RabbitFileSplit::ByteFormat
- Included in:
- Bytes
- Defined in:
- lib/rabbit_file_split/byte_format.rb
Instance Method Summary collapse
Instance Method Details
#to_byte(n_byte) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rabbit_file_split/byte_format.rb', line 4 def to_byte(n_byte) case n_byte when /(\d)KB/ then n_byte.sub(/KB/,'').to_i * 1024 when /(\d)MB/ then n_byte.sub(/MB/,'').to_i * 1048576 when /(\d)GB/ then n_byte.sub(/GB/,'').to_i * 1073741824 else n_byte.to_i end end |