Sha256: 5cbfe5a4a15863b9c4891b6be2a48f9f99fe1bc0d2ef5cf05737c9ab9faf7961

Contents?: true

Size: 801 Bytes

Versions: 14

Compression:

Stored size: 801 Bytes

Contents

# frozen_string_literal: true

module Esse
  module Deprecations
    module Deprecate
      def self.extended(base)
        base.extend Gem::Deprecate
        base.include InstanceMethods
      end

      module InstanceMethods
        def warning(method, repl, year, month)
          msg = ["NOTE: #{method} is deprecated"]
          msg << if repl == :none
            ' with no replacement'
          elsif repl.respond_to?(:call)
            "; use #{repl.call} instead"
          else
            "; use #{repl} instead"
          end
          msg << '. It will be removed on or after %4d-%02d-01.' % [year, month]
          msg << "\n#{method} called from #{Gem.location_of_caller(2).join(':')}"

          warn "#{msg.join}." unless Gem::Deprecate.skip
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
esse-0.4.0.rc4 lib/esse/deprecations/deprecate.rb
esse-0.4.0.rc3 lib/esse/deprecations/deprecate.rb
esse-0.4.0.rc2 lib/esse/deprecations/deprecate.rb
esse-0.4.0.rc1 lib/esse/deprecations/deprecate.rb
esse-0.3.5 lib/esse/deprecations/deprecate.rb
esse-0.3.4 lib/esse/deprecations/deprecate.rb
esse-0.3.3 lib/esse/deprecations/deprecate.rb
esse-0.3.2 lib/esse/deprecations/deprecate.rb
esse-0.3.1 lib/esse/deprecations/deprecate.rb
esse-0.3.0 lib/esse/deprecations/deprecate.rb
esse-0.2.6 lib/esse/deprecations/deprecate.rb
esse-0.2.5 lib/esse/deprecations/deprecate.rb
esse-0.2.4 lib/esse/deprecations/deprecate.rb
esse-0.2.3 lib/esse/deprecations/deprecate.rb