Class: ActiveSupport::NumberHelper::NumberToDelimitedConverter
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
NumberConverter
|
|
Instance Chain:
self,
NumberConverter
|
|
Inherits: |
ActiveSupport::NumberHelper::NumberConverter
|
Defined in: | activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb |
Constant Summary
-
DEFAULT_DELIMITER_REGEX =
# File 'activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb', line 10/(\d)(?=(\d\d\d)+(?!\d))/
NumberConverter
- Inherited
Class Attribute Summary
NumberConverter
- Inherited
Class Method Summary
NumberConverter
- Inherited
Instance Attribute Summary
NumberConverter
- Inherited
Instance Method Summary
- #convert
- #delimiter_pattern private
- #parts private
NumberConverter
- Inherited
Constructor Details
This class inherits a constructor from ActiveSupport::NumberHelper::NumberConverter
Instance Method Details
#convert
[ GitHub ]# File 'activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb', line 12
def convert parts.join( [:separator]) end
#delimiter_pattern (private)
[ GitHub ]# File 'activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb', line 25
def delimiter_pattern .fetch(:delimiter_pattern, DEFAULT_DELIMITER_REGEX) end
#parts (private)
[ GitHub ]# File 'activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb', line 17
def parts left, right = number.to_s.split(".") left.gsub!(delimiter_pattern) do |digit_to_delimit| "#{digit_to_delimit}#{ [:delimiter]}" end [left, right].compact end