From: Caleb Clausen Date: 2005-11-08T00:36:32+09:00 Subject: Re: Lazy fun: Make unary minus silence stderr for backticks On 11/6/05, Sam Stephenson wrote: > (It would be nice to have a mixin alternative to BlankSlate.) I hacked up a BlankSlate module for my own purposes. (This version doesn't permenently remove any methods, just renames them to something.... unusual.) Here it is: module BlankSlate; module ClassMethods def restore(*names) names.each{|name| alias_method name, "##{name}"} end def hide(*names) names.each do|name| undef_method name if instance_methods.include?(name.to_s) end end end def BlankSlate.included(othermod) othermod.instance_eval { instance_methods.each { |m| alias_method "##{m}", m #archive m undef_method m unless m =~ /^__/ || m=='instance_eval' } extend BlankSlate::ClassMethods } end end