给定这样的类结构:
class Notifiers::NotifierBase
def initialize
end
end
module Notifiers
module Profile
class TipNotifier < NotifierBase
end
end
end
当我运行时Notifiers::Profile.constants []返回。我不应该看到类常量TipNotifier吗?
如果我调用Notifiers::Profile::TipNotifier,那么如果我调用Notifiers::Profile.constants,我会将此对象作为数组的一部分返回。[:TipNotifier]. 我在这里想念什么?
也许我应该补充一点,这些示例位于 Rails 项目中作为全局命名空间的一部分包含的文件中。BaseNotifier是全局命名空间的一部分。