Sha256: 0ae30ddc19c64f0369fbbdc89eba1a8863fd1f07cdbc76a31e0accb0ada59f45

Contents?: true

Size: 755 Bytes

Versions: 32

Compression:

Stored size: 755 Bytes

Contents

module Tabulo

  # @!visibility private
  module Deprecation

    # @!visibility private
    def self.skipping_warnings
      @skipping_warnings ||= false
    end

    # @!visibility private
    def self.skipping_warnings=(v)
      @skipping_warnings = v
    end

    # @!visibility private
    def self.without_warnings
      original = skipping_warnings
      self.skipping_warnings = true
      yield
    ensure
      self.skipping_warnings = original
    end

    # @!visibility private
    def self.warn(deprecated, replacement, stack_level = 1)
      return if skipping_warnings

      kaller = Kernel.caller[stack_level]
      Kernel.warn "#{kaller}: [DEPRECATION] #{deprecated} is deprecated. Please use #{replacement} instead."
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
tabulo-3.0.3 lib/tabulo/deprecation.rb
tabulo-3.0.2 lib/tabulo/deprecation.rb
tabulo-3.0.1 lib/tabulo/deprecation.rb
tabulo-3.0.0 lib/tabulo/deprecation.rb
tabulo-2.8.2 lib/tabulo/deprecation.rb
tabulo-2.8.1 lib/tabulo/deprecation.rb
tabulo-2.8.0 lib/tabulo/deprecation.rb
tabulo-2.7.3 lib/tabulo/deprecation.rb
tabulo-2.7.2 lib/tabulo/deprecation.rb
tabulo-2.7.1 lib/tabulo/deprecation.rb
tabulo-2.7.0 lib/tabulo/deprecation.rb
tabulo-2.6.3 lib/tabulo/deprecation.rb
tabulo-2.6.2 lib/tabulo/deprecation.rb
tabulo-2.6.1 lib/tabulo/deprecation.rb
tabulo-2.6.0 lib/tabulo/deprecation.rb
tabulo-2.5.0 lib/tabulo/deprecation.rb
tabulo-2.4.1 lib/tabulo/deprecation.rb
tabulo-2.4.0 lib/tabulo/deprecation.rb
tabulo-2.3.3 lib/tabulo/deprecation.rb
tabulo-2.3.2 lib/tabulo/deprecation.rb