On 4/22/06, Pat Maddox <pergesu / gmail.com> wrote: > Can someone explain to me what the difference is between the inline > code example, and specifying it inside the class? A class definition introduces a new scope (similar to def) so for your example to work you need to define the local variable ~within~ the class definition for it to be visible from the closure, e.g. class A var = "initialized variable" class_eval { define_method(:talk) { puts var } } end A.new.talk #=> initialized variable Regards, Sean