class Apkstats::Helper::Bytes::Byte

Attributes

value[R]

Public Class Methods

new(value) click to toggle source
# File lib/apkstats/helper/bytes.rb, line 30
def initialize(value)
  @value = value
end

Public Instance Methods

to_b() click to toggle source
# File lib/apkstats/helper/bytes.rb, line 34
def to_b
  value
end
to_kb() click to toggle source
# File lib/apkstats/helper/bytes.rb, line 38
def to_kb
  Bytes.up_unit(value)
end
to_mb() click to toggle source
# File lib/apkstats/helper/bytes.rb, line 42
def to_mb
  Bytes.up_unit(to_kb)
end
to_s_b() click to toggle source
# File lib/apkstats/helper/bytes.rb, line 46
def to_s_b
  add_op(to_b)
end
to_s_kb() click to toggle source
# File lib/apkstats/helper/bytes.rb, line 50
def to_s_kb
  add_op(to_kb)
end
to_s_mb() click to toggle source
# File lib/apkstats/helper/bytes.rb, line 54
def to_s_mb
  add_op(to_mb)
end

Private Instance Methods

add_op(size) click to toggle source
# File lib/apkstats/helper/bytes.rb, line 60
def add_op(size)
  size.negative? ? size.to_s : "+#{size}"
end