Sha256: 6497a95722f436e60f3f3ace76dc78ee28fc2964ea3a3fb15af1b712e496ed13
Contents?: true
Size: 551 Bytes
Versions: 1
Compression:
Stored size: 551 Bytes
Contents
module Humanize module Bytes class Mega def initialize(value) @value = value end def value @value end def to_b @value * 1024 * 1024 end def to_k @value * 1024 end def to_g @value / 1024.0 end def to_s @value.instance_of?(Float) ? formatted_float + ' mega bytes' : @value.to_s + ' mega bytes' end protected def formatted_float @value.to_s[0 .. @value.to_s.index('.') + 2] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
humanize-bytes-0.0.1 | lib/humanize-bytes/mbyte.rb |