Module: Twitter::TwitterText::Deprecation
- Included in:
- Autolink, Rewriter, Validation
- Defined in:
- lib/twitter-text/deprecation.rb
Instance Method Summary collapse
Instance Method Details
#deprecate(method, new_method = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/twitter-text/deprecation.rb', line 8 def deprecate(method, new_method = nil) deprecated_method = :"deprecated_#{method}" = "Deprecation: `#{method}` is deprecated." << " Please use `#{new_method}` instead." if new_method alias_method(deprecated_method, method) define_method method do |*args, &block| warn unless $TESTING send(deprecated_method, *args, &block) end end |