Module: DataMapper::Deprecate

Included in:
Property
Defined in:
lib/dm-core/support/deprecate.rb

Instance Method Summary collapse

Instance Method Details

#deprecate(old_method, new_method) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/dm-core/support/deprecate.rb', line 3

def deprecate(old_method, new_method)
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
    def #{old_method}(*args, &block)
      warn "\#{self.class}##{old_method} is deprecated, use \#{self.class}##{new_method} instead (\#{caller.first})"
      send(#{new_method.inspect}, *args, &block)
    end
  RUBY
end