Dlaczego metoda modułu „ja” nie może stać się pojedynczą metodą klasy?
<code>module Test def self.model_method puts "this is a module method" end end class A include Test end A.model_method </code>
będzie to błąd z:
niezdefiniowana metoda `model_method 'dla A: Class (NoMethodError)
Ale kiedy używam metaklasy A. działa:
<code>module Test def model_method puts "this is a module method" end end class A class << self include Test end end A.model_method </code>
Czy ktoś może to wyjaśnić?