-
Notifications
You must be signed in to change notification settings - Fork 1
Use constantize #13
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
Use constantize #13
Conversation
|
allows Rails-style autoloading, lgtm |
|
interesting stuff |
|
looking at the code I don't follow your logic on it incorrectly associating B with B::X when given 'A::B::X' given the fact its using reduce. |
|
@james-lawrence would this work better for you? uses ActiveSupport's constant lookup if ActiveSupport is defined |
|
LGTM |
|
I'm still against it because no one has figured out WHY it breaks in the current form. so we are patching something that we don't understand. Instead of finding the underlying cause which could be causing other issues in our system we are ignoring. |
Looks like A.const_get(B) finds global B that is up the chain in the global scope. Giving inherit=false to const_Get seems to do what we want. |
|
@wr0ngway nice find, I was just wondering if that's what was happening! |
|
@wr0ngway cool! Let me give that a shot, I think that's a nicer solution |
|
@wr0ngway Thanks for that find =) |
|
More explicitly what's happening from a |
|
LGTM |
Currently, Qless::Job attempts to find constants by splitting the worker_class string (e.g.,
'Jobs::GoogleMail::Backup::Master'becomes['Jobs', 'GoogleMail', 'Backup', 'Master']and looking up each successive constant within the scope of the previous constant. This works most of the time. However, if you have constants likeA::B::CandB::X, given'A::B::C', Qless will incorrectly return theBassociated withB::Xand throw a NameError trying to findCwithin thatB. This restricts the way we can name things in CORE. Given the entire properly scoped class name,constantizedoesn't run into this issue.