我知道背后隐藏着一个依赖管理系统ActiveSupport::Concern
。我不完全理解它(我不确定我是否已经准备好),但简而言之:是否可以ActiveSupport::Concern
与香草(非ActiveSupport::Concern
)模块混合,还是有陷阱?
以下是我能想到的不同用法的一些示例
module Vanilla
module ModuleIncludedInASC
# Vanilla module
end
module ModuleIncludedInClass
# Vanilla module
end
module ASC
module ConcernIncludedInClass
extend ActiveSupport::Concern
...
end
module ConcernIncludedInASC
extend ActiveSupport::Concern
...
end
module ConcernIncludingVanillaModulesIncludedInClass
extend ActiveSupport::Concern
include Vanilla::VanillaConcernIncludedInASC
end
module ConcernIncludingASCConcernIncludedInASC
extend ActiveSupport::Concern
include ConcernIncludedInASC
end
end
class MyFoo
include Vanilla::ModuleIncludedInClass
include ASC::ConcernIncludedInClass
include ASC::ConcernIncludingVanillaModulesIncludedInClass
end
# Ans also possibly, ActiveSupport::Concern modules included in vanilla modules...?
这可能会导致问题吗?