module A; end module B; module C; end module D; end end QQQ = B::D class X include A include B, B::C, NOTEXIST end module Y include B::C, B if X == 2 include A include QQQ class << self; include A; end end module Z include A, B end module ABC module FOO; end module DEF module FOO include ABC::FOO end module BAR include ABC::BAR end end end