From: Gregory Brown Date: 2009-02-03T02:56:01+09:00 Subject: Re: Kernel.xxx interferes with method_missing On Mon, Feb 2, 2009 at 12:11 PM, Alexey Petrushin wrote: > Hello! > > I'm using method_missing to create DSL, the problem is that Kernel.xxx > methods are interferes with it. > How this issue can be solved? > > It seems that one solution is to explicitly define all global methods > (p, select, ...) on the target class for method_missing. > > But i hope there is more elegant solution :). Maybe some trick with > sandboxes? On Ruby 1.9, use BasicObject. On Ruby 1.8, use Jim Weirich's BlankSlate object. I recently ran into an issue with blankslate though where it was incorrectly revealing methods, so you might want to use my patched version: http://pastie.org/377487.txt Take this with a shaker of salt though, I mainly modified the example to show off certain dynamic programming techniques in my book[0], and not necessarily to make it robust. I have emailed Jim about these changes, but he hasn't gotten back to me yet. -greg