Class: Steroids::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/steroids/railtie.rb

Overview


Custom loader (Zeitwerk)


Instance Method Summary collapse

Instance Method Details

#file_update_checker(&loader) ⇒ Object



19
20
21
22
# File 'lib/steroids/railtie.rb', line 19

def file_update_checker(&loader)
  watch_list = Dir["#{gem_path}/**/*.rb"]
  @file_update_checker ||= ActiveSupport::FileUpdateChecker.new(watch_list, &loader)
end

#load_extensions!Object



11
12
13
14
15
16
17
# File 'lib/steroids/railtie.rb', line 11

def load_extensions!
  core_extensions = File.expand_path("#{gem_path}/steroids/extensions/**/**/*.rb", __dir__)
  extensions_dir = Dir.glob(core_extensions)
  Dir.glob(extensions_dir).sort.each do |path|
    require path
  end
end

#zeitwerkObject



24
25
26
27
28
29
30
31
# File 'lib/steroids/railtie.rb', line 24

def zeitwerk
  @loader ||= Zeitwerk::Loader.new.tap do |loader|
    loader.tag = "steroids"
    loader.enable_reloading
    loader.push_dir(gem_path)
    loader.inflector = Zeitwerk::GemInflector.new("#{gem_path}/steroids.rb")
  end
end