Sha256: 7cee334afc7e874c5d32bfffd1259b04678339a378751135422566195d1d9d7c

Contents?: true

Size: 668 Bytes

Versions: 5

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true

require "time"

class Time
  NOT_SET = Object.new # :nodoc:
  def to_s(format = NOT_SET) # :nodoc:
    if formatter = DATE_FORMATS[format]
      ActiveSupport::Deprecation.warn(
        "Time#to_s(#{format.inspect}) is deprecated. Please use Time#to_formatted_s(#{format.inspect}) instead."
      )
      formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
    elsif format == NOT_SET
      to_default_s
    else
      ActiveSupport::Deprecation.warn(
        "Time#to_s(#{format.inspect}) is deprecated. Please use Time#to_formatted_s(#{format.inspect}) instead."
      )
      to_default_s
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activesupport-7.0.1 lib/active_support/core_ext/time/deprecated_conversions.rb
activesupport-7.0.0 lib/active_support/core_ext/time/deprecated_conversions.rb
activesupport-7.0.0.rc3 lib/active_support/core_ext/time/deprecated_conversions.rb
activesupport-7.0.0.rc2 lib/active_support/core_ext/time/deprecated_conversions.rb
activesupport-7.0.0.rc1 lib/active_support/core_ext/time/deprecated_conversions.rb