I have a class that looks like this:
puts "I say hello"
I say hello
class_methods.rb:11:in `<class:Test>': undefined local variable or method `goodbye' for Test:Class (NameError)
from class_methods.rb:1:in `<main>'
What is hello being called on?
Whenever there isn't an explicit receiver, the receiver is
self. So the call is implicitly:
self is the class
Test, on which you have just defined the
goodbye is not found because it is defined on an instance of class
Test, not the class itself, where it's currently called.