aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/big_decimal/conversions.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/big_decimal/conversions.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb b/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
index 234283e792..52bd229416 100644
--- a/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
@@ -1,15 +1,14 @@
-require 'bigdecimal'
-require 'bigdecimal/util'
+# frozen_string_literal: true
-class BigDecimal
- DEFAULT_STRING_FORMAT = 'F'
- alias_method :to_default_s, :to_s
+require "bigdecimal"
+require "bigdecimal/util"
- def to_s(format = nil, options = nil)
- if format.is_a?(Symbol)
- to_formatted_s(format, options || {})
- else
- to_default_s(format || DEFAULT_STRING_FORMAT)
+module ActiveSupport
+ module BigDecimalWithDefaultFormat #:nodoc:
+ def to_s(format = "F")
+ super(format)
end
end
end
+
+BigDecimal.prepend(ActiveSupport::BigDecimalWithDefaultFormat)