Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully qualify the Queue class to avoid conflicts with other libraries #999

Closed
wants to merge 1 commit into from

Conversation

rafaelfranca
Copy link

We have a minitest plugin that defines a module called Queue, so we weren't not able to use the parallel executor because the wrong Queue constant is being resolved in its initializer.

To make sure we are using the correct Queue class, we need to fully qualify it with Thread::Queue.

This matches how Ruby document the Queue class in the standard library, and how Ruby itself refer to it in the source code.

We have a minitest plugin that defines a module called `Queue`,
so we weren't not able to use the parallel executor because the
wrong Queue constant is being resolved in its initializer.

To make sure we are using the correct Queue class, we need to fully
qualify it with `Thread::Queue`.

This matches how Ruby document the [Queue class in the standard
library][1], and how [Ruby itself refer to it in the source code][2].

[1]: https://docs.ruby-lang.org/en/3.3/Thread/Queue.html
[2]: ruby/ruby@4b298ad
anmarchenko referenced this pull request in KnapsackPro/knapsack_pro-ruby May 16, 2024
@fxn
Copy link

fxn commented May 16, 2024

Since minitest documents ways to extend it by reopening the Minitest module, it loses control of the constants defined in Minitest. I believe this patch is good in that sense.

@ParadoxV5
Copy link

@rafaelfranca rafaelfranca deleted the rm-fix-queue branch May 22, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants