Skip to content

Commit

Permalink
Detect and fix invalid autoloads
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Feb 3, 2025
1 parent 1b9de03 commit 170fb27
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 19 additions & 0 deletions config/quickdraw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,26 @@

Bundler.require :test

module AutoloadRecorder
AUTOLOADS = []

def self.load_all
AUTOLOADS.each do |(mod, name)|
mod.const_get(name)
end
end

def autoload(name, path)
super
::AutoloadRecorder::AUTOLOADS << [self, name].freeze
end
end

Module.prepend(AutoloadRecorder)

require "phlex"

AutoloadRecorder.load_all

# Previous content of test helper now starts here
$LOAD_PATH.unshift(File.expand_path("../fixtures", __dir__))
2 changes: 0 additions & 2 deletions lib/phlex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
module Phlex
autoload :ArgumentError, "phlex/errors/argument_error"
autoload :CSV, "phlex/csv"
autoload :Callable, "phlex/callable"
autoload :Context, "phlex/context"
autoload :DoubleRenderError, "phlex/errors/double_render_error"
autoload :Elements, "phlex/elements"
autoload :Error, "phlex/error"
autoload :FIFO, "phlex/fifo"
autoload :FIFOCacheStore, "phlex/fifo_cache_store"
Expand Down

0 comments on commit 170fb27

Please sign in to comment.