class Filesize
def pretty(args = {})
- See: #to_s -
Returns:
-
(String)
-
def pretty(args = {}) size = @bytes if size < @type[:multiplier] unit = "B" else pos = (Math.log(size) / Math.log(@type[:multiplier])).floor pos = @type[:prefixes].size-1 if pos > @type[:prefixes].size - 1 unit = @type[:prefixes][pos-1] + "B" end to_s(unit, args) end