Class: Gloo::Utils::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo/utils/format.rb

Class Method Summary collapse

Class Method Details

.number(num) ⇒ Object

Format number, adding comma separators. Ex: 1000 -> 1,000



15
16
17
# File 'lib/gloo/utils/format.rb', line 15

def self.number( num )
  return num.to_s.reverse.scan( /.{1,3}/ ).join( ',' ).reverse
end