Sha256: e37971602eedad744fc815b359a39a548ca67db0abc60573fac8c931e85f9397
Contents?: true
Size: 342 Bytes
Versions: 18
Compression:
Stored size: 342 Bytes
Contents
# frozen_string_literal: true # @private module String::GruffCommify THOUSAND_SEPARATOR = ',' private_constant :THOUSAND_SEPARATOR refine String do # Taken from http://codesnippets.joyent.com/posts/show/330 def commify(delimiter = THOUSAND_SEPARATOR) gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}") end end end
Version data entries
18 entries across 18 versions & 1 rubygems