Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/collins_shell/monkeypatch.rb
Instance Method Summary collapse
Instance Method Details
#to_human_size ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/collins_shell/monkeypatch.rb', line 6 def to_human_size return "0 Bytes" if (self == 0) i = (Math.log(self) / Math.log(1024)).floor.to_i small = self / (1024 ** i) if i == 0 then "#{self} #{SIZE_ARRAY[i]}" else sprintf("%.14f %s", small, SIZE_ARRAY[i]) end end |