Sha256: 1375c40b57e369da9715985a1f77a381681637c20043d0efa5f3af2402f2a17c
Contents?: true
Size: 302 Bytes
Versions: 8
Compression:
Stored size: 302 Bytes
Contents
# frozen_string_literal: true # @private module String::GruffCommify 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
8 entries across 8 versions & 1 rubygems