Module Deprecate
In: lib/rubygems/deprecate.rb

Provides a single method deprecate to be used to declare when something is going away.

    class Legacy
      def self.klass_method
        # ...
      end

      def instance_method
        # ...
      end

      extend Deprecate
      deprecate :instance_method, "X.z", 2011, 4

      class << self
        extend Deprecate
        deprecate :klass_method, :none, 2011, 4
      end
    end

Methods

Public Instance methods

Simple deprecation method that deprecates name by wrapping it up in a dummy method. It warns on each call to the dummy method telling the user of repl (unless repl is :none) and the year/month that it is planned to go away.

[Source]

    # File lib/rubygems/deprecate.rb, line 49
49:   def deprecate name, repl, year, month
50:     class_eval {
51:       old = "_deprecated_#{name}"
52:       alias_method old, name
53:       define_method name do |*args|
54:         klass = self.kind_of? Module
55:         target = klass ? "#{self}." : "#{self.class}#"
56:         msg = [ "NOTE: #{target}#{name} is deprecated",
57:                 repl == :none ? " with no replacement" : ", use #{repl}",
58:                 ". It will be removed on or after %4d-%02d-01." % [year, month],
59:                 "\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}\n",
60:               ]
61:         warn "#{msg.join}." unless Deprecate.skip
62:         send old, *args
63:       end
64:     }
65:   end

Temporarily turn off warnings. Intended for tests only.

[Source]

    # File lib/rubygems/deprecate.rb, line 36
36:   def skip_during
37:     Deprecate.skip, original = true, Deprecate.skip
38:     yield
39:   ensure
40:     Deprecate.skip = original
41:   end

[Validate]