module Apkstats::Helper::Bytes
Constants
- STEP
Public Class Methods
down_unit(size)
click to toggle source
# File lib/apkstats/helper/bytes.rb, line 23 def self.down_unit(size) size.to_f * STEP end
from_b(byte)
click to toggle source
# File lib/apkstats/helper/bytes.rb, line 7 def self.from_b(byte) Byte.new(byte) end
from_kb(k_byte)
click to toggle source
# File lib/apkstats/helper/bytes.rb, line 11 def self.from_kb(k_byte) Byte.new(down_unit(k_byte)) end
from_mb(m_byte)
click to toggle source
# File lib/apkstats/helper/bytes.rb, line 15 def self.from_mb(m_byte) Byte.new(down_unit(down_unit(m_byte))) end
up_unit(size)
click to toggle source
# File lib/apkstats/helper/bytes.rb, line 19 def self.up_unit(size) (size.to_f / STEP).round(2) end