Sha256: eb8169ff2ac8bc3a60ef2bd707671e131a2ad39fa2d3881997dbb1020a164152

Contents?: true

Size: 634 Bytes

Versions: 5

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

class Array
  NOT_SET = Object.new # :nodoc:
  def to_s(format = NOT_SET) # :nodoc:
    case format
    when :db
      ActiveSupport::Deprecation.warn(
        "Array#to_s(#{format.inspect}) is deprecated. Please use Array#to_formatted_s(#{format.inspect}) instead."
      )
      if empty?
        "null"
      else
        collect(&:id).join(",")
      end
    when NOT_SET
      to_default_s
    else
      ActiveSupport::Deprecation.warn(
        "Array#to_s(#{format.inspect}) is deprecated. Please use Array#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/array/deprecated_conversions.rb
activesupport-7.0.0 lib/active_support/core_ext/array/deprecated_conversions.rb
activesupport-7.0.0.rc3 lib/active_support/core_ext/array/deprecated_conversions.rb
activesupport-7.0.0.rc2 lib/active_support/core_ext/array/deprecated_conversions.rb
activesupport-7.0.0.rc1 lib/active_support/core_ext/array/deprecated_conversions.rb