Sha256: 929d0ee8a3b503e7ad10775e1f8c3b08f35c7a7743567d801c1213ef8168c6dc

Contents?: true

Size: 463 Bytes

Versions: 3

Compression:

Stored size: 463 Bytes

Contents

module Twitter
  module Deprecation
    def deprecate(method, new_method = nil)
      deprecated_method = :"deprecated_#{method}"
      message = "Deprecation: `#{method}` is deprecated."
      message << " Please use `#{new_method}` instead." if new_method

      alias_method(deprecated_method, method)
      define_method method do |*args, &block|
        warn message unless $TESTING
        send(deprecated_method, *args, &block)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitter-text-2.0.2 lib/twitter-text/deprecation.rb
twitter-text-2.0.1 lib/twitter-text/deprecation.rb
twitter-text-2.0.0 lib/twitter-text/deprecation.rb