I have also chosen a variable name that matches the parameter in the definition of load_missing_constant.
Basically, const_missing had a loop to try parent namespaces if the constant lookup failed, but at the same time delegated to load_missing_constant which in turn also walks up parent namespaces calling const_missing by hand. In the case of missing constants this results in repeated work in some funky nested way.
…ified_name}" Users need to know the ultimate problem here is that AS was trying to autoload a constant and it failed.
Nowadays circular autoloads do not work, but the user gets a NameError that says some constant is undefined. That's puzzling, because he is normally trying to autoload a constant he knows can be autoloaded. With this check we can give a better error message.
We simplify two things here: First since * is greedy it is enough to go look for the rightmost ::, no need to ask the regexp engine to match the rest of the string since we are not validating anything, only capturing. The second simplification comes from using a look-ahead assertion, that allows us to have the capture in $&, thus removing the need of a group.
…e#load" This argument is there because that's the signature of Kernel#load. This reverts commit bf3fa34.
Ruby does not pass the nesting to const_missing (unfortunately). That second argument was there in case that changed, Yehuda sent a patch to MRI http://bugs.ruby-lang.org/issues/2740 but there is not much movement there and Matz told me in Amsterdam there was no immediate plan to pass the nesting. So let's go back to implement what happens now, and if in the future we get the nesting then we will adapt this. Double-checked this with Mr Katz.
Ruby 2.0.0 implements LoadError#path, but newly raised load errors will not contain the path information. Replace the error message, copy blame, and rereaise the same exception object
This is an obsolete method from the very early days, apparently it was used circa 2004 because STI support was not smart enough. This method is not public interface, and we are heading a major version, so removal seems right.
there is no need in local_const_defined? helper method
* Refactor log subscriber, use select! to avoid a new object * Remove deprecation messages related to AS::Deprecation behavior This was added about 2 years ago for Rails 3: d4c7d3f * Remove some not used requires * Refactor delegate to avoid string conversions and if statements inside each block
A patch has been provided earlier and we have asked for feedback: https://gist.github.com/1437939 Except one case, all other cases showed improvements in boot time.
Test coverage isn't comprehensive enough to catch what this breaks. :( This reverts commit 45dad59.
…ntize This commit also implements a faster version of #demodulize I was unable to isolate with git add --patch. Not a big fan of the name #deconstantize. It complements #demodulize getting rid of the rightmost constant, hence the name, but it is unrelated to the well-known #constantize. So unsure. Could not come with anything better, please feel free to rename.
Under ruby 1.9.2 - "/var/log".starts_with?(Pathname.new("/var")) # => false so setting config.autoload_once_paths with Pathnames would not work