Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/netapp/monkey_patches/integer.rb
Instance Method Summary collapse
Instance Method Details
#to_h(unit = :GB, num = self) ⇒ Object
20 21 22 |
# File 'lib/netapp/monkey_patches/integer.rb', line 20 def to_h(unit = :GB, num = self) "#{self.to_u(unit, num)} #{unit.to_s}" end |
#to_u(unit = :GB, num = self) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/netapp/monkey_patches/integer.rb', line 3 def to_u(unit = :GB, num = self) case unit when :MB num /= 1024 when :GB 2.times do num /= 1024 end num when :TB 3.times do num /= 1024 end num end end |