Class: Orthoses::Zeitwerk
- Inherits:
-
Object
- Object
- Orthoses::Zeitwerk
- Defined in:
- lib/orthoses/zeitwerk.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(loader) ⇒ Zeitwerk
constructor
A new instance of Zeitwerk.
Constructor Details
#initialize(loader) ⇒ Zeitwerk
Returns a new instance of Zeitwerk.
5 6 7 |
# File 'lib/orthoses/zeitwerk.rb', line 5 def initialize(loader) @loader = loader end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/orthoses/zeitwerk.rb', line 9 def call tracer = Orthoses::CallTracer::Lazy.new tracer.trace('Zeitwerk::Cref#set') do @loader.call end.tap do |store| tracer.captures.each do |capture| value = capture.argument[:value] name = Orthoses::Utils.module_name(value) or next next unless value.is_a?(Module) store[name].header = "module #{name}" end end end |