Deprecated

This just occurred to me (for Java fans):

class Module
def deprecated *meths
meths.each do |me|
aliased = “deprecate#{me}”
alias_method aliased, me
class_eval “def #{me}(*a,&b) $stderr.puts ‘WARNING: deprecated
method called: #{me}’; #{aliased}(*a,&b) end”
end
end
end

irb(main):010:0> class String
irb(main):011:1> deprecated :to_i
irb(main):012:1> end
=> [:to_i]
irb(main):013:0> “123”.to_i
WARNING: deprecated method called: to_i
=> 123
irb(main):014:0>

Kind regards

robert