Module: Tapioca::Runtime::Trackers::Autoload
- Extended by:
- Tracker
- Defined in:
- lib/tapioca/runtime/trackers/autoload.rb
Class Method Summary collapse
-
.eager_load_all! ⇒ Object
: -> void.
-
.register(constant_name) ⇒ Object
: (String constant_name) -> void.
Methods included from Tracker
disable!, enabled?, extended, with_disabled_tracker
Class Method Details
.eager_load_all! ⇒ Object
: -> void
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tapioca/runtime/trackers/autoload.rb', line 14 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
26 27 28 29 30 |
# File 'lib/tapioca/runtime/trackers/autoload.rb', line 26 def register(constant_name) return unless enabled? @constant_names_registered_for_autoload << constant_name end |