Class: Zeitwerk::Registry::Inceptions
- Inherits:
-
Object
- Object
- Zeitwerk::Registry::Inceptions
- Defined in:
- lib/zeitwerk/registry/inceptions.rb
Overview
Loaders know their own inceptions, but there is a use case in which we need to know if a given cpath is an inception globally. This is what this registry is for.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ Inceptions
constructor
A new instance of Inceptions.
- #register(cref, abspath) ⇒ Object
- #registered?(cref) ⇒ Boolean
- #unregister(cref) ⇒ Object
Constructor Details
#initialize ⇒ Inceptions
Returns a new instance of Inceptions.
7 8 9 |
# File 'lib/zeitwerk/registry/inceptions.rb', line 7 def initialize @inceptions = Zeitwerk::Cref::Map.new #: Zeitwerk::Cref::Map[String] end |
Instance Method Details
#clear ⇒ Object
27 28 29 |
# File 'lib/zeitwerk/registry/inceptions.rb', line 27 def clear # for tests @inceptions.clear end |
#register(cref, abspath) ⇒ Object
12 13 14 |
# File 'lib/zeitwerk/registry/inceptions.rb', line 12 def register(cref, abspath) @inceptions[cref] = abspath end |
#registered?(cref) ⇒ Boolean
17 18 19 |
# File 'lib/zeitwerk/registry/inceptions.rb', line 17 def registered?(cref) @inceptions[cref] end |
#unregister(cref) ⇒ Object
22 23 24 |
# File 'lib/zeitwerk/registry/inceptions.rb', line 22 def unregister(cref) @inceptions.delete(cref) end |