aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
blob: 843c592669a8d1c4f7beae982c6fa6856a937c26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require 'bigdecimal'
require 'bigdecimal/util'

class BigDecimal
  DEFAULT_STRING_FORMAT = 'F'
  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
  alias_method :_original_to_s, :to_s
  alias_method :to_s, :to_formatted_s
end