Sha256: 9ada5a2c74585b87e099e7c38611267e0e61d9a70e3723d84e19c163e4846c6e

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

module Humanize
  class Kilo < Bytes
    def to_b
      Byte.new @value * 1024
    end

    def to_k
      self
    end

    def to_m
      Mega.new @value / 1024.0
    end

    def to_g
      Giga.new @value / 1024.0 / 1024
    end

    def to_t
      Tera.new @value / 1024.0 / 1024.0 / 1024.0
    end

    def to_p
      Peta.new @value / 1024.0 / 1024.0 / 1024.0 / 1024.0
    end

    def to_e
      Exa.new @value / 1024.0 / 1024.0 / 1024.0 / 1024.0 / 1024.0
    end

    def to_z
      Zetta.new @value / 1024.0 / 1024.0 / 1024.0 / 1024.0 / 1024.0 / 1024.0
    end

    def to_y
      Yotta.new @value / 1024.0 / 1024.0 / 1024.0 / 1024.0 / 1024.0 / 1024.0 / 1024.0
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
humanize-bytes-2.2.0 lib/humanize/kilo.rb