Sha256: 2ddcb92f4877abdc5b5af148e17cc3143c6cc941d0681da3aabd7477434b6d06

Contents?: true

Size: 616 Bytes

Versions: 41

Compression:

Stored size: 616 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_fs(#{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_fs(#{format.inspect}) instead."
      )
      to_default_s
    end
  end
end

Version data entries

41 entries across 38 versions & 9 rubygems

Version Path
activesupport-7.0.2 lib/active_support/core_ext/array/deprecated_conversions.rb