aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/dependencies.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add missed require making `enable_warnings` availableDmitry Vorotilin2013-10-151-0/+1
|
* revises the docs of require_dependency [ci skip]Xavier Noria2013-10-011-1/+9
|
* Merge pull request #12412 from bf4/allow_pathname_for_require_dependencyXavier Noria2013-09-301-1/+3
|\ | | | | Allow Pathname for require dependency
| * require_dependency should allow Pathname-like objects, not just StringBenjamin Fleischer2013-09-301-1/+3
| |
* | Ensure all-caps nested consts marked as autoloadedSimon Coffey2013-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Previously, an autoloaded constant `HTML::SomeClass` would not be marked as autoloaded by AS::Dependencies. This is because the `#loadable_constants_for_path` method uses `String#camelize` on the inferred file path, which in turn means that, unless otherwise directed, AS::Dependencies watches for loaded constants in the `Html` namespace. By passing the original qualified constant name to `#load_or_require`, this inference step is avoided, and the new constant is picked up in the correct namespace.
* | we only support 1.9+, so just check for a nameAaron Patterson2013-06-171-1/+1
| |
* | be consistent about parameter types passed to new_constants_inAaron Patterson2013-06-171-1/+1
| |
* | Don't blindly call blame_file! on exceptions in ↵Andrew Kreiling2013-06-091-1/+1
|/ | | | | | | | | | | | ActiveSupport::Dependencies::Loadable It is possible under some environments to receive an Exception that is not extended with Blamable (e.g. JRuby). ActiveSupport::Dependencies::Loadable#load_dependency blindly call blame_file! on the exception which throws it's own NoMethodError exception and hides the original Exception. This commit fixes #9521
* Replace some global Hash usages with the new thread safe cache.thedarkone2012-12-141-1/+2
| | | | | | | | | | | | | | | | Summary of the changes: * Add thread_safe gem. * Use thread safe cache for digestor caching. * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation. * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache. * Use TS::Cache to avoid the synchronisation overhead on listener retrieval. * Replace synchronisation with TS::Cache usage. * Use a preallocated array for performance/memory reasons. * Update the controllers cache to the new AS::Dependencies::ClassCache API. The original @controllers cache no longer makes much sense after @tenderlove's changes in 7b6bfe84f3 and f345e2380c. * Use TS::Cache in the connection pool to avoid locking overhead. * Use TS::Cache in ConnectionHandler.
* Replace comments' non-breaking spaces with spacesclaudiob2012-12-041-3/+3
| | | | | | | | | | Sometimes, on Mac OS X, programmers accidentally press Option+Space rather than just Space and don’t see the difference. The problem is that Option+Space writes a non-breaking space (0XA0) rather than a normal space (0x20). This commit removes all the non-breaking spaces inadvertently introduced in the comments of the code.
* prevent Dependencies#remove_const from autoloading parents [fixes #8301]Xavier Noria2012-11-281-32/+44
|
* let remove_constant still delete Kernel#autoload constants [rounds #8213]Xavier Noria2012-11-151-10/+22
| | | | | The method #remove_const does not load the file, so we can still remove the constant.
* dependencies no longer trigger Kernel#autoload in remove_const [fixes #8213]Xavier Noria2012-11-151-13/+31
|
* update AS docs [ci skip]Francesco Rodriguez2012-09-171-36/+43
|
* we already have the module objects, do not constantizeXavier Noria2012-09-061-2/+6
| | | | | I have also chosen a variable name that matches the parameter in the definition of load_missing_constant.
* restores awesome commentXavier Noria2012-09-061-0/+19
| | | | Those who say source code should be without comments lie.
* no more const_missing combinatoricsXavier Noria2012-09-061-41/+2
| | | | | | | | 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.
* revised the exception message "Expected #{file_path} to define ↵Xavier Noria2012-09-041-1/+1
| | | | | | | #{qualified_name}" Users need to know the ultimate problem here is that AS was trying to autoload a constant and it failed.
* fixes a regexpXavier Noria2012-08-291-1/+1
| | | | | | | | We need to anchor to remove the extension. In addition to be the correct way to do that, files in ~/.rbenv get that .rb removed, so it is a real source of bugs, as reported in https://github.com/rails/rails/commit/b33700f5580b4cd85379a1dc60fa341ac4d8deb2#commitcomment-1781840
* detect circular constant autoloadingXavier Noria2012-08-281-4/+11
| | | | | | | 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.
* fixes a bug in dependencies.rbXavier Noria2012-08-281-1/+1
| | | | | | | loaded stores file names without the .rb extension, but search_for_file returns file names with the extension. The solution is hackish, but this file needs a revamp.
* simplifies yet another regexpXavier Noria2012-08-251-1/+1
|
* instead of returning $& if =~ succeeds, use String#[]Xavier Noria2012-08-251-1/+1
|
* simplifies a regexpXavier Noria2012-08-251-1/+1
| | | | | | | | 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.
* simplifies a regexpXavier Noria2012-08-241-1/+1
| | | | | The new regexp has less work to do, we anchor a fixed string at the end and need no group.
* Revert "removes unused optional argument in AS::Dependencies::Loadable#load"Xavier Noria2012-08-201-1/+1
| | | | | | This argument is there because that's the signature of Kernel#load. This reverts commit bf3fa34ed0aa33bca3aac9c96165662fe864a7b4.
* removes unused optional argument in AS::Dependencies::Loadable#loadXavier Noria2012-08-201-1/+1
|
* removes the second argument of the AS const_missing hookXavier Noria2012-08-191-8/+22
| | | | | | | | | | | | | | | 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.
* no need for AS::Dependencies.(hook!|unhook!) to return anything in particularXavier Noria2012-08-191-2/+0
|
* raise the same exception in order to keep path infoAaron Patterson2012-06-121-1/+2
| | | | | | 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
* removes the obsolete require_association method from dependenciesXavier Noria2012-06-101-17/+5
| | | | | | | | 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.
* use const_defined? with second argument in AS::DependenciesSergey Nartimov2012-05-131-7/+3
| | | | there is no need in local_const_defined? helper method
* Remove deprecation from AS::Deprecation behavior, some minor cleanupsCarlos Antonio da Silva2012-03-161-17/+12
| | | | | | | | | * 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: https://github.com/rails/rails/commit/d4c7d3fd94e5a885a6366eaeb3b908bb58ffd4db * Remove some not used requires * Refactor delegate to avoid string conversions and if statements inside each block
* deprecates Module#local_constant_namesXavier Noria2012-01-121-2/+2
|
* Remove more dead code from AS.José Valim2011-12-201-18/+4
|
* Just track "require" if we have something in the watching stack.José Valim2011-12-061-1/+5
| | | | | | | | 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.
* make method signatures match the superclass signatureAaron Patterson2011-12-051-2/+2
|
* return value is never tested, so stop calling `presence`Aaron Patterson2011-12-051-1/+1
|
* switch WatchStack to use composition, tighten up APIAaron Patterson2011-11-301-6/+13
|
* Revert "avoid hundreds of thousands of calls to (Symbol|String)#to_s"Aaron Patterson2011-11-301-2/+2
| | | | | Test coverage isn't comprehensive enough to catch what this breaks. :( This reverts commit 45dad592e47944704ab6951351b2fa29d4a2385f.
* avoid hundreds of thousands of calls to (Symbol|String)#to_sAaron Patterson2011-11-301-2/+2
|
* Rely solely on active_model_serializer and remove the fancy constant lookup.José Valim2011-11-231-0/+1
|
* Add safe_constantize to ActiveSupport::Dependencies.José Valim2011-11-231-13/+20
|
* Fixed typo: expect -> expectedPhilip Arndt2011-11-181-1/+1
|
* defines Module#qualified_const_(defined?|get|set) and String#deconstantizeXavier Noria2011-10-291-6/+8
| | | | | | | | | | 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.
* Fix autoload_once_paths when using Pathnames & ruby 1.9Jonathan del Strother2011-08-241-1/+2
| | | | | | | Under ruby 1.9.2 - "/var/log".starts_with?(Pathname.new("/var")) # => false so setting config.autoload_once_paths with Pathnames would not work
* `load` should also return the value from `super`Aaron Patterson2011-08-231-1/+3
|
* require needs to return true or false. thank you Ryan "zenspider" DavisAaron Patterson2011-08-231-1/+3
|
* delay backtrace scrubbing until we actually raise an exception. fixes #1936Aaron Patterson2011-07-291-7/+4
|
* Replace unnecessary regexp in Dependencies#load_missing_constantJonathan del Strother2011-07-271-2/+1
|