From: Francis Hwang Date: 2005-05-29T10:31:23+09:00 Subject: Re: preventing Object#send from dispatching to a global method? Yeah, that makes sense. I can use that workaround, but the code I'm looking at is in a library that others might use, and I'd rather not impose that workaround on others who might accidentally define global methods that trip over my library's reflection. I wonder if this an appropriate place for an RCR ... seems to me that with all the Ruby libs out there that use some intense reflection, somebody else must be worrying about this? Maybe not. On May 28, 2005, at 3:50 PM, itsme213 wrote: > Imo, this is a result of global methods becoming methods on the Object > class. If they had been made singleton methods of the "main" object > your > method_missing would work as you expect. > > > "Francis Hwang" wrote in message >> Is there a way to prevent Object#send from dispatching to a global >> method? By which I mean: >> >> def something; end >> >> class SomeClass >> def method_missing( sym, *args ) .... do magic; end >> end >> >> SomeClass.new.something # I'd like this to go to >> SomeClass#method_missing, not Kernel#something >> >> I can manage this other ways, but I'd love to use something like send, >> if possible. >> >> Francis Hwang >> http://fhwang.net/ >> >> >> > > > > Francis Hwang http://fhwang.net/