Module: ActiveSupport::DeprecatedNumericWithFormat
- Included in:
- BigDecimal, Float, Integer
- Defined in:
- lib/active_support/core_ext/numeric/deprecated_conversions.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#to_s(format = nil, options = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/active_support/core_ext/numeric/deprecated_conversions.rb', line 5 def to_s(format = nil, = nil) return super() if format.nil? case format when Integer, String super(format) when :phone ActiveSupport::Deprecation.warn( "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead." ) ActiveSupport::NumberHelper.number_to_phone(self, || {}) when :currency ActiveSupport::Deprecation.warn( "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead." ) ActiveSupport::NumberHelper.number_to_currency(self, || {}) when :percentage ActiveSupport::Deprecation.warn( "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead." ) ActiveSupport::NumberHelper.number_to_percentage(self, || {}) when :delimited ActiveSupport::Deprecation.warn( "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead." ) ActiveSupport::NumberHelper.number_to_delimited(self, || {}) when :rounded ActiveSupport::Deprecation.warn( "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead." ) ActiveSupport::NumberHelper.number_to_rounded(self, || {}) when :human ActiveSupport::Deprecation.warn( "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead." ) ActiveSupport::NumberHelper.number_to_human(self, || {}) when :human_size ActiveSupport::Deprecation.warn( "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead." ) ActiveSupport::NumberHelper.number_to_human_size(self, || {}) when Symbol ActiveSupport::Deprecation.warn( "#{self.class}#to_s(#{format.inspect}) is deprecated. Please use #{self.class}#to_fs(#{format.inspect}) instead." ) super() else super(format) end end |