Class: Jets::Autoloaders
- Inherits:
-
Object
- Object
- Jets::Autoloaders
- Includes:
- Enumerable
- Defined in:
- lib/jets/autoloaders.rb,
lib/jets/autoloaders/gem.rb,
lib/jets/autoloaders/inflector.rb
Defined Under Namespace
Modules: Inflector Classes: Gem, GemInflector
Instance Attribute Summary collapse
-
#main ⇒ Object
readonly
Returns the value of attribute main.
-
#once ⇒ Object
readonly
Returns the value of attribute once.
Class Method Summary collapse
Instance Method Summary collapse
- #each {|main| ... } ⇒ Object
-
#initialize ⇒ Autoloaders
constructor
A new instance of Autoloaders.
- #log! ⇒ Object
- #logger=(logger) ⇒ Object
Constructor Details
#initialize ⇒ Autoloaders
Returns a new instance of Autoloaders.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jets/autoloaders.rb', line 13 def initialize # This `require` delays loading the library on purpose. # # In Rails 7.0.0, railties/lib/rails.rb loaded Zeitwerk as a side-effect, # but a couple of edge cases related to Bundler and Bootsnap showed up. # They had to do with order of decoration of `Kernel#require`, something # the three of them do. # # Delaying this `require` up to this point is a convenient trade-off. require "zeitwerk" @main = Zeitwerk::Loader.new @main.tag = "jets.main" @main.inflector = Inflector @once = Zeitwerk::Loader.new @once.tag = "jets.once" @once.inflector = Inflector end |
Instance Attribute Details
#main ⇒ Object (readonly)
Returns the value of attribute main.
11 12 13 |
# File 'lib/jets/autoloaders.rb', line 11 def main @main end |
#once ⇒ Object (readonly)
Returns the value of attribute once.
11 12 13 |
# File 'lib/jets/autoloaders.rb', line 11 def once @once end |
Class Method Details
Instance Method Details
#each {|main| ... } ⇒ Object
33 34 35 36 |
# File 'lib/jets/autoloaders.rb', line 33 def each yield main yield once end |
#log! ⇒ Object
42 43 44 |
# File 'lib/jets/autoloaders.rb', line 42 def log! each(&:log!) end |
#logger=(logger) ⇒ Object
38 39 40 |
# File 'lib/jets/autoloaders.rb', line 38 def logger=(logger) each { |loader| loader.logger = logger } end |