From: nobu.nokada@... Date: 2004-01-21T07:31:11+09:00 Subject: Re: A suggestion for libraries such as base64.rb Hi, At Tue, 20 Jan 2004 14:43:16 +0900, Dave Thomas wrote: > This doesn't break any existing code, but when we document the module > we can strongly recommend that folks use the encapsulated forms instead > of the global methods. Then, at some later date, we can remove the > include statement at stop the methods being inserted at the top level. I guess it should be warned, rather than just aliased. Index: lib/base64.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/base64.rb,v retrieving revision 1.2 diff -u -2 -p -d -w -r1.2 base64.rb --- lib/base64.rb 20 Jan 2004 05:44:45 -0000 1.2 +++ lib/base64.rb 20 Jan 2004 22:16:33 -0000 @@ -13,4 +13,6 @@ require "kconv" +module Base64 + module_function # Returns the Base64-decoded version of \obj{str}. @@ -83,2 +85,16 @@ def b64encode(bin, len = 60) end end + + module Deprecated + include Base64 + + for m in Base64.private_instance_methods(false) + define_method(m) do |*args| + warn("#{caller[0]}: #{m} is deprecated; use Base64.#{m} instead") + super(*args) + end + end + end +end + +include Base64::Deprecated -- Nobu Nakada