Sha256: a649b50103186d1aa9f77b04e526b79fb3fc562ba57e45bc6caf8c1e603c0165

Contents?: true

Size: 920 Bytes

Versions: 15

Compression:

Stored size: 920 Bytes

Contents

# frozen_string_literal: true

require "mime/types/logger"

# The namespace for MIME applications, tools, and libraries.
module MIME
  ##
  class Types
    # Used to mark a method as deprecated in the mime-types interface.
    def self.deprecated(klass, sym, message = nil, &block) # :nodoc:
      level =
        case klass
              when Class, Module
                "."
              else
                klass = klass.class
                "#"
        end
      message =
        case message
                when :private, :protected
                  "and will be #{message}"
                when nil
                  "and will be removed"
                else
                  message
        end
      MIME::Types.logger.warn <<-WARNING.chomp.strip
        #{caller(2..2).first}: #{klass}#{level}#{sym} is deprecated #{message}.
      WARNING

      return unless block
      block.call
    end
  end
end

Version data entries

15 entries across 15 versions & 6 rubygems

Version Path
kinetic_sdk-5.0.22 gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
kinetic_sdk-5.0.21 gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
kinetic_sdk-5.0.20 gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb
mime-types-3.4.1 lib/mime/types/deprecations.rb