From: nobu.nokada@... Date: 2004-08-06T12:14:25+09:00 Subject: Re: help from *nix ruby users Hi, At Thu, 5 Aug 2004 22:02:48 +0900, Nicholas Van Weerdenburg wrote in [ruby-talk:108380]: > How would I normally determine if something is deprecated in ruby? After > your email, I tried "ruby -w -e 'p PLATFORM'" but didn't see any > warnings of deprecation (if that would be one way to check). Constants are not accessed with a method, so we don't have a way to check about it. Only I think out is a trick using const_missing. class Object class << self depr = [:VERSION, :PLATFORM, :RELEASE_DATE] define_method(:const_missing) do |i| if depr.include?(i) warn "#{caller(2)[0]}: #{i} is deprecated, use RUBY_#{i}" const_get("RUBY_#{i}") else begin super(i) rescue NameError $@[0,2] = nil raise end end end depr end.each(&method(:remove_const)) end -- Nobu Nakada