From: Jim Weirich Date: 2005-05-29T11:29:08+09:00 Subject: Re: preventing Object#send from dispatching to a global method? --Apple-Mail-2--559893624 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On May 28, 2005, at 11:42 AM, Francis Hwang wrote: > Is there a way to prevent Object#send from dispatching to a global > method? By which I mean: > You could look at how Builder::BlankSlate handles it. It uses method defined hooks to undefine any methods added to any ancestors. You can find BlankSlate in the builder gem. For example traken$ irb --simple-prompt >> require 'builder/blankslate' => false >> class Empty < Builder::BlankSlate >> def inspect >> "" >> end >> def method_missing(sym, *args) >> puts "Calling #{sym}(#{args.join(',')})" >> end >> end => nil >> e = Empty.new => >> e.hi Calling hi() => nil >> def hi() "HI" end => nil >> e.hi Calling hi() => nil --Apple-Mail-2--559893624--