Module: Twitter::Utils::ClassMethods

Defined in:
lib/twitter/utils.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) deprecate_alias(new_name, old_name)



10
11
12
13
14
15
16
17
18
19
# File 'lib/twitter/utils.rb', line 10

def deprecate_alias(new_name, old_name)
  define_method(new_name) do |*args|
    warn "#{Kernel.caller.first}: [DEPRECATION] ##{new_name} is deprecated. Use ##{old_name} instead."
    if block_given?
      send(old_name, *args, &Proc.new)
    else
      send(old_name, *args)
    end
  end
end