Module: Tapioca::Runtime::Trackers::Autoload

Extended by:
T::Sig, Tracker
Defined in:
lib/tapioca/runtime/trackers/autoload.rb

Class Method Summary collapse

Methods included from Tracker

disable!, enabled?, extended, with_disabled_tracker

Class Method Details

.eager_load_all!Object

: -> void



17
18
19
20
21
22
23
24
25
26
# File 'lib/tapioca/runtime/trackers/autoload.rb', line 17

def eager_load_all!
  Runtime.with_disabled_exits do
    until @constant_names_registered_for_autoload.empty?
      # Grab the next constant name
      constant_name = T.must(@constant_names_registered_for_autoload.shift)
      # Trigger autoload by constantizing the registered name
      Reflection.constantize(constant_name, inherit: true)
    end
  end
end

.register(constant_name) ⇒ Object

: (String constant_name) -> void



29
30
31
32
33
# File 'lib/tapioca/runtime/trackers/autoload.rb', line 29

def register(constant_name)
  return unless enabled?

  @constant_names_registered_for_autoload << constant_name
end