Sha256: 143af5124a4281d26ae364bd28dfd938097fd7a136ea35ea63f1114021f98cc8

Contents?: true

Size: 534 Bytes

Versions: 2

Compression:

Stored size: 534 Bytes

Contents

require "humanize-bytes/version"

module Humanize
  module Bytes
    autoload :Byte, 'humanize-bytes/byte'
    autoload :Kilo, 'humanize-bytes/kbyte'
    autoload :Mega, 'humanize-bytes/mbyte'
    autoload :Giga, 'humanize-bytes/gbyte'

    def self.initialize(value, unit = 'b')
      case unit
        when 'k' then Humanize::Bytes::Kilo.new(value)
        when 'm' then Humanize::Bytes::Mega.new(value)
        when 'g' then Humanize::Bytes::Giga.new(value)
        else Humanize::Bytes::Byte.new(value)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
humanize-bytes-0.0.2 lib/humanize-bytes.rb
humanize-bytes-0.0.1 lib/humanize-bytes.rb