From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2001-10-24T04:47:07+09:00 Subject: [ruby-talk:23081] Re: Deprecate keyword? (what does 'module_eval <, Pierre-Charles David wrote: >Morris, Chris wrote: I was looking through your code snippet and there is an idiom that I don't understand, so I thought I'd ask and maybe learn something... > >---------------------------------------------------- >class Module > def deprecate(methodName) What does this following line mean/do? > module_eval < alias_method :deprecated_#{methodName}, :#{methodName} > def #{methodName}(*args) > $stderr.puts "Warning: calling deprecated method >#{self}.#{methodName}" > return deprecated_#{methodName}(*args) > end >END > end >end > >class Foo > def print; puts "foo"; end >end > >Foo.new.print > >class Foo > deprecate :print >end > >Foo.new.print Phil