Sha256: af1b9d565c451d495290f2af87cb4bc04909ba29e20344ce14126d07b7cb945f

Contents?: true

Size: 640 Bytes

Versions: 5

Compression:

Stored size: 640 Bytes

Contents

# Copyright 2018 Twitter, Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0

module Twitter
  module TwitterText
    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
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
twitter-text-kow-1.3.1.0 lib/twitter-text/deprecation.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/twitter-text-3.1.0/lib/twitter-text/deprecation.rb
twitter-text-3.1.0 lib/twitter-text/deprecation.rb
twitter-text-simpleidn-3.0.0.0 lib/twitter-text/deprecation.rb
twitter-text-3.0.0 lib/twitter-text/deprecation.rb