Unexpected token operator «=», expected punc «,»
尽管require 'active_support/concern'
module M
extend ActiveSupport::Concern
included do
def self.b
puts 'b'
end
end
class_methods do
def a
puts 'a'
end
end
end
class H
include M
end
是在class_methods
中定义类方法的标准方法,但我确实找到了一些示例,人们在其中使用ActiveSupport::Concern
来声明类方法。 / p>
两种方法都可行,如果在included
内定义了类方法,是否存在边缘情况?