Module: ActiveSupport::DeprecatedRangeWithFormat
- Included in:
- Range
- Defined in:
- lib/active_support/core_ext/range/deprecated_conversions.rb
Overview
:nodoc:
Constant Summary collapse
- NOT_SET =
:nodoc:
Object.new
Instance Method Summary collapse
- #to_s(format = NOT_SET) ⇒ Object (also: #to_default_s)
Instance Method Details
#to_s(format = NOT_SET) ⇒ Object Also known as: to_default_s
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/active_support/core_ext/range/deprecated_conversions.rb', line 6 def to_s(format = NOT_SET) if formatter = RangeWithFormat::RANGE_FORMATS[format] ActiveSupport::Deprecation.warn( "Range#to_s(#{format.inspect}) is deprecated. Please use Range#to_fs(#{format.inspect}) instead." ) formatter.call(first, last) elsif format == NOT_SET if formatter = RangeWithFormat::RANGE_FORMATS[:default] ActiveSupport::Deprecation.warn( "Using a :default format for Range#to_s is deprecated. Please use Range#to_fs instead." ) formatter.call(first, last) else super() end else ActiveSupport::Deprecation.warn( "Range#to_s(#{format.inspect}) is deprecated. Please use Range#to_fs(#{format.inspect}) instead." ) super() end end |