Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/extensions/fixnum.rb

Instance Method Summary collapse

Instance Method Details

#to_human_sizeObject



2
3
4
5
6
7
8
# File 'lib/extensions/fixnum.rb', line 2

def to_human_size
  case self
    when 1024..1048576 then "#{self / 1024} kb"
    when 1048576..1073741824 then "#{self / 1048576} mb"
    else "#{self} bytes"
  end
end