Module: Zeitwerk::ConstAdded
- Defined in:
- lib/zeitwerk/core_ext/module.rb
Instance Method Summary collapse
Instance Method Details
#const_added(cname) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/zeitwerk/core_ext/module.rb', line 4 def const_added(cname) if loader = Zeitwerk::ExplicitNamespace.__loader_for(self, cname) namespace = const_get(cname, false) unless namespace.is_a?(Module) cref = Zeitwerk::Cref.new(self, cname) raise Zeitwerk::Error, "#{cref.path} is expected to be a namespace, should be a class or module (got #{namespace.class})" end loader.on_namespace_loaded(namespace) end super end |