Sha256: 94a5fe3723defa886a49c12a2ce212ea9f84bdefe3b5983d56c63907bd67de5e

Contents?: true

Size: 359 Bytes

Versions: 12

Compression:

Stored size: 359 Bytes

Contents

# frozen_string_literal: true

module Spout
  module Helpers
    # Provides method to format large numbers with delimiters.
    module NumberHelper
      def number_with_delimiter(number, delimiter = ",")
        number.to_s.reverse.scan(/(?:\d*\.)?\d{1,3}-?/).join(delimiter).reverse
      end

      module_function :number_with_delimiter
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spout-1.0.0 lib/spout/helpers/number_helper.rb
spout-1.0.0.beta3 lib/spout/helpers/number_helper.rb
spout-1.0.0.beta2 lib/spout/helpers/number_helper.rb
spout-1.0.0.beta1 lib/spout/helpers/number_helper.rb
spout-0.14.1 lib/spout/helpers/number_helper.rb
spout-0.14.0 lib/spout/helpers/number_helper.rb
spout-0.14.0.rc lib/spout/helpers/number_helper.rb
spout-0.14.0.beta3 lib/spout/helpers/number_helper.rb
spout-0.14.0.beta2 lib/spout/helpers/number_helper.rb
spout-0.14.0.beta1 lib/spout/helpers/number_helper.rb
spout-0.13.0 lib/spout/helpers/number_helper.rb
spout-0.13.0.beta2 lib/spout/helpers/number_helper.rb