>>>>> "J" == Jim Freeze <jim / freeze.org> writes:

J> class Fred
J>   def fred
J>     puts "1"
J>   end
J>   fred    # undefined local variable or method `fred' for Fred:Class

 Well, at compile ruby has not found the local variable `fred' this is the
 first part of the message

     undefined local variable `fred'

 This mean that `fred' will be interpreted as a method call, i.e. `fred()'
 and because you are at class level (i.e. self = Fred), it will try to call
 the method Fred::fred 

 at runtime it has not found the method Fred::fred, this is the second part
 of the message

   undefined method `fred'

J> end

 At toplevel you have

pigeon% ruby -e 'p self, self.class'
main
Object
pigeon%

 In the class you have

pigeon% ruby -e 'class Fred; p self, self.class; end'
Fred
Class
pigeon% 


Guy Decoux