Module: Spout::Helpers::NumberHelper

Included in:
Commands::Coverage, Commands::Outliers
Defined in:
lib/spout/helpers/number_helper.rb

Overview

Provides method to format large numbers with delimiters.

Class Method Summary collapse

Class Method Details

.number_with_delimiter(number, delimiter = ",") ⇒ Object



7
8
9
# File 'lib/spout/helpers/number_helper.rb', line 7

def number_with_delimiter(number, delimiter = ",")
  number.to_s.reverse.scan(/(?:\d*\.)?\d{1,3}-?/).join(delimiter).reverse
end