class Integer

Open up the Integer class to add a formatting method.

Public Instance Methods

to_comma_formatted() click to toggle source
# File lib/core_ext/integer.rb, line 5
def to_comma_formatted
  to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, '\\1,')
end