undefined local variable or method `current_dirs'
choosen opened this issue · 5 comments
choosen commented
Hello , I got some error using eager_load_namespace
.
# boot.rb
loader = Zeitwerk::Loader.new
loader.push_dir(__dir__)
loader.ignore("#{__dir__}/spec")
loader.ignore("#{__dir__}/ruby")
loader.collapse("#{__dir__}/config")
loader.collapse("#{__dir__}/lib")
loader.inflector.inflect(
"graphql" => "GraphQL"
)
loader.setup
loader.eager_load_namespace(Faraday::Encoding) # the issue eager_load
Failure/Error: require_relative '../boot'
NameError:
undefined local variable or method `current_dirs' for #<Zeitwerk::Loader:0x00000001377e5f08>
# ./boot.rb:14:in `<top (required)>'
current_dirs
seems to be not defined in the code
zeitwerk (2.6.4) @ ruby 2.7.6
fxn commented
Fixed in 2.6.6.
fxn commented
What is your use case for eager_load_namespace
?
choosen commented
I tried to load overridden code from gem, but it did not work (finally I just used require_relative)
But I found a bug at least : )
fxn commented
I tried to load overridden code from gem, but it did not work (finally I just used require_relative)
Oh yes, eager loading is scoped to what the loader manages.
But I found a bug at least : )
Indeed, it was worthwhile if only just for this :).
choosen commented
thanks for chat : )
and the fix, Xavier