Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/core_ext/integer.rb
Overview
Open up the Integer class to add a formatting method.
Instance Method Summary collapse
Instance Method Details
#to_comma_formatted ⇒ Object
5 6 7 |
# File 'lib/core_ext/integer.rb', line 5 def to_comma_formatted to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, '\\1,') end |