Sha256: f40e2d0f497c64de8b2d3e2361a64507b4684d28616640849b371e7d171eb8a6

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 Bytes

Contents

# frozen_string_literal: true

module Kind
  module DEPRECATION # :nodoc: all
    WARN_IS_DISABLED = String(ENV['DISABLE_KIND_DEPRECATION']).strip == 't'

    module DevNull
      def self.warn(_)
      end
    end

    OUTPUT = WARN_IS_DISABLED ? DevNull : ::Kernel

    def self.warn(message)
      OUTPUT.warn("[DEPRECATION] #{message}" % { version: 'version 5.0' })
    end

    def self.warn_method_replacement(old_method, new_method)
      self.warn "`#{old_method}` is deprecated, it will be removed in %{version}. " \
        "Please use `#{new_method}` instead."
    end

    def self.warn_removal(name)
      self.warn "`#{name}` is deprecated, it will be removed in %{version}."
    end

    private_constant :DevNull, :OUTPUT
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kind-4.1.0 lib/kind/core/deprecation.rb
kind-4.0.0 lib/kind/core/deprecation.rb