--Apple-Mail-5--554997153 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset -ASCII; formatðïwed On Aug 02, 2007, at 08:24 , dblack / rubypal.com wrote: > Sure. Let's say you want to do: > > a > class C > def show_a > a # won't work > end > end > > The definition of a won't make it into the scope of the method > definition #show_a, because both the class keyword and the def keyword > start a new local scope. > > However, class_eval and define_method are both permeable, as to scope. > So you can do: > > a > class C; end > C.class_eval { define_method(:show_a) { a } } > > C.new.show_a # 1 > > The a inside the block given to define_method is the same a that I > defined in the first line. That's what I mean by flattening the > variable scope. > > David That makes complete sense. Thank you kindly for the explanation. -- Wayne E. Seguin Sr. Systems Architect & Systems Admin wayneseguin / gmail.com --Apple-Mail-5--554997153--