class Integer
Constants
- UNITS
Public Instance Methods
byte_format()
click to toggle source
1024 => 1KB
# File vendor/qwik/lib/qwik/util-basic.rb, line 30 def byte_format n = self UNITS.each {|unit| t = n/1024 if t > 0 n = t else return n.to_s + unit end } return n.to_s + _(unit) end
commify()
click to toggle source
12345.commify => ‘12,345’
# File vendor/qwik/lib/qwik/util-basic.rb, line 22 def commify numstr = self.to_s true while numstr.sub!(/^([-+]?\d+)(\d{3})/, '\1,\2') return numstr end