123456789_123456789_123456789_123456789_123456789_

Class: Rails::Autoloaders

Do not use. This class is for internal use only.
Relationships & Source Files
Namespace Children
Modules:
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
Inherits: Object
Defined in: railties/lib/rails/autoloaders.rb,
railties/lib/rails/autoloaders/inflector.rb

Class Method Summary

Instance Attribute Summary

::Enumerable - Included

#many?

Returns true if the enumerable has more than 1 element.

Instance Method Summary

::Enumerable - Included

#compact_blank

Returns a new ::Array without the blank items.

#exclude?

The negative of the Enumerable#include?.

#excluding

Returns a copy of the enumerable excluding the specified elements.

#in_order_of

Returns a new ::Array where the order has been set to that provided in the series, based on the key of the objects in the original enumerable.

#including

Returns a new array that includes the passed elements.

#index_by

Convert an enumerable to a hash, using the block result as the key and the element as the value.

#index_with

Convert an enumerable to a hash, using the element as the key and the block result as the value.

#maximum

Calculates the maximum from the extracted elements.

#minimum

Calculates the minimum from the extracted elements.

#pick

Extract the given key from the first element in the enumerable.

#pluck

Extract the given key from each element in the enumerable.

#sole

Returns the sole item in the enumerable.

#without
#as_json

::ActiveSupport::EnumerableCoreExt::Constants - Included

Constructor Details

.newAutoloaders

[ GitHub ]

  
# File 'railties/lib/rails/autoloaders.rb', line 11

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 = "rails.main"
  @main.inflector = Inflector

  @once = Zeitwerk::Loader.new
  @once.tag = "rails.once"
  @once.inflector = Inflector
end

Instance Attribute Details

#logger=(logger) (writeonly)

[ GitHub ]

  
# File 'railties/lib/rails/autoloaders.rb', line 36

def logger=(logger)
  each { |loader| loader.logger = logger }
end

#main (readonly)

[ GitHub ]

  
# File 'railties/lib/rails/autoloaders.rb', line 9

attr_reader :main, :once

#once (readonly)

[ GitHub ]

  
# File 'railties/lib/rails/autoloaders.rb', line 9

attr_reader :main, :once

#zeitwerk_enabled?Boolean (readonly)

[ GitHub ]

  
# File 'railties/lib/rails/autoloaders.rb', line 44

def zeitwerk_enabled?
  true
end

Instance Method Details

#each {|main| ... }

Yields:

[ GitHub ]

  
# File 'railties/lib/rails/autoloaders.rb', line 31

def each
  yield main
  yield once
end

#log!

[ GitHub ]

  
# File 'railties/lib/rails/autoloaders.rb', line 40

def log!
  each(&:log!)
end