module String::GruffCommify
@private
Constants
- THOUSAND_SEPARATOR
Public Instance Methods
Source
# File lib/gruff/patch/string.rb, line 10 def commify(delimiter = THOUSAND_SEPARATOR) gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}") # steep:ignore end
Taken from codesnippets.joyent.com/posts/show/330