I wrote a tutorial a few months ago that describes how/why the following
worked:
module Translator
module ClassMethods
def translate
end
end
def included(receiver)
receiver.extend(ClassMethods)
end
end
class C
include Translator
end
But, now it doesn’t work.
Effectively I expect the translate method to become a class-level method
of C. Instead I’m told C doesn’t know about that method.
If I call C.extend(Translator::ClassMethods) I get what I’d expect.
Have I been wrong this entire time or did something change?
ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-darwin9.2.2]