Class: BigDecimal
Constant Summary
-
DEFAULT_STRING_FORMAT =
# File 'activesupport/lib/active_support/core_ext/big_decimal/conversions.rb', line 5'F'
-
YAML_MAPPING =
# File 'activesupport/lib/active_support/core_ext/big_decimal/yaml_conversions.rb', line 10{ 'Infinity' => '.Inf', '-Infinity' => '-.Inf', 'NaN' => '.NaN' }
Instance Method Summary
- #_original_to_s
- #encode_with(coder)
- #to_formatted_s(*args) (also: #to_s)
-
#to_s(*args)
Alias for #to_formatted_s.
Instance Method Details
#_original_to_s
[ GitHub ]# File 'activesupport/lib/active_support/core_ext/big_decimal/conversions.rb', line 14
alias_method :_original_to_s, :to_s
#encode_with(coder)
[ GitHub ]# File 'activesupport/lib/active_support/core_ext/big_decimal/yaml_conversions.rb', line 12
def encode_with(coder) string = to_s coder.represent_scalar(nil, YAML_MAPPING[string] || string) end
#to_formatted_s(*args) Also known as: #to_s
[ GitHub ]# File 'activesupport/lib/active_support/core_ext/big_decimal/conversions.rb', line 6
def to_formatted_s(*args) if args[0].is_a?(Symbol) super else format = args[0] || DEFAULT_STRING_FORMAT _original_to_s(format) end end
#to_s(*args)
Alias for #to_formatted_s.
# File 'activesupport/lib/active_support/core_ext/big_decimal/conversions.rb', line 15
alias_method :to_s, :to_formatted_s