Why doesn't this work?
module Greeter
def self.greet
puts "anyang"
end
end
Greeter.greet # => anyang
class KoreanKid
include Greeter
greet
end
# !> NameError : undefined local variable or method `greet' for KoreanKid:Class
KoreanKid.greet
# !> NoMethodError : undefined method `greet' for KoreanKid:Class
When I call greet right inside the KoreanKid class, that's just simply calling a class method right? That's the same thing as KoreanKid.greet right? Why doesn't the above work?
In my module, I'll have a mix of class methods and instance methods... how do I get both to work cleanly?