Because when this method is executed:
def message(message)
@@message = message
end
@@ message refers to a class variable in the ClassMethods module (and not in the ExtendedClass class)
Here's a one-line change that makes it work the way you expect:
def message(message)
self.send(:class_variable_set, "@@message", message)
end
This is a bit antipattern (using send to get around the fact that class_variable_set is private), but I believe it answers the question.
NTN