On Sun, Jul 10, 2011 at 10:16:25AM +0900, Eric Hodel wrote: > On Jul 9, 2011, at 4:19 PM, Rodrigo Rosenfeld Rosas wrote: > > Em 09-07-2011 20:13, Nobuyoshi Nakada escreveu: > > > Sorry, Nobu, I didn't get it. Could you explain it better? > > I think Nobu means that formerly OptionParser used instance_eval like slop does inside the parse method. > > This was changed due to confusion of scoping and methods available inside and outside the instance_eval. > > I'd prefer not to have hidden instance_eval for option parsing. It's too often that I like to refer to items in a scope the execution environment doesn't have. This reminds me that I instead instance_eval rely on method injection. What I currently do is temporary add singleton method_missing to delegate methods. It has relatively sane scoping. I am wondering if there is way that is not as ugly as my current implementation. def redef(&b) b.binding.eval " class <<self if self.instance_methods.include? \"method_missing\" @r=true alias_method :mm2,:method_missing end def method_missing(n,*a) Del.send(n,*a) if Del.respond_to? n mm2(n,*a) if self.respond_to? :mm2 end end" b.call b.binding.eval " class <<self if @r alias_method :method_missing,:mm2 else remove_method :method_missing end end " end -- Your Pentium has a heating problem - try cooling it with ice cold water.(Do not turn of your computer, you do not want to cool down the Pentium Chip while he isn't working, do you?)