Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/jkr/numeric.rb
Instance Method Summary collapse
Instance Method Details
#to_hstr ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/jkr/numeric.rb', line 3 def to_hstr if self < 2**10 self.to_s elsif self < 2**20 sprintf('%dK', self / 2**10) elsif self < 2**30 sprintf('%dM', self / 2**20) else sprintf('%dG', self / 2**30) end end |