From: Ian Leitch Date: 2007-09-14T00:04:55+09:00 Subject: Closures defined inside a class method ------=_Part_18678_9807506.1189695893551 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline This is just weird... class ClassA def self.func1 def func2 puts "In func2" end func2 end end > ClassA.func1 => NameError: undefined local variable or method `func2' for ClassA:Class I can call other class methods without explicitly referencing the class first due to the fact the call is made in class scope, so why can't I define a method in class scope without explicitly prefixing it with 'self'? Also... class ClassB def self.func1 def func2 puts "In func2" end end end > a = ClassB.new > a.func2 => "In func2" func2 looks as though it's defined as a closure inside class scope func1 (though it isn't ^^^^), yet I can call it on an instance of the class? Someone please explain! ------=_Part_18678_9807506.1189695893551--