lib/humanize-bytes.rb in humanize-bytes-0.1.0 vs lib/humanize-bytes.rb in humanize-bytes-1.0.0
- old
+ new
@@ -5,19 +5,15 @@
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
+ def self.initialize(value, unit = 'b')
+ case unit.to_s
when 'b' then Humanize::Bytes::Byte.new(value)
when 'k' then Humanize::Bytes::Kilo.new(value)
when 'm' then Humanize::Bytes::Mega.new(value)
when 'g' then Humanize::Bytes::Giga.new(value)
- when :b then Humanize::Bytes::Byte.new(value)
- 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 nil
end
end
end
end
\ No newline at end of file