module BatchKit::NumericExtensions

Public Instance Methods

with_commas() click to toggle source

Converts an integer to a comma-separated string, e.g. 1024 becomes “1,024”

# File lib/batch-kit/core_ext/numeric.rb, line 6
def with_commas
    self.to_s.gsub(/(\d)(?=(\d{3})+(?!\d))/, "\\1,")
end