Sha256: b5dc5bbbbbcd424a905bd78241334a3b671aa7cae4b0f942b811ee2598e7b6a9
Contents?: true
Size: 563 Bytes
Versions: 1
Compression:
Stored size: 563 Bytes
Contents
module Humanize module Bytes class Giga def initialize(value) @value = value end def value @value end def to_b @value * 1024 * 1024 * 1024 end def to_k @value * 1024 * 1024 end def to_m @value * 1024 end def to_s @value.instance_of?(Float) ? formatted_float + ' giga bytes' : @value.to_s + ' giga 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/gbyte.rb |