aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/class/subclasses.rb
Commit message (Collapse)AuthorAgeFilesLines
* Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-251-1/+1
|
* Remove redundant require_relative "module/anonymous" and "module/reachable"bogdanvlviv2017-09-171-3/+0
|
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-011-2/+2
|
* Exclude singleton classes from `subclasses` and `descendants`Sean Griffin2016-12-011-0/+1
| | | | | | | | This behavior changed in Ruby starting with 2.3.0, as a result of https://bugs.ruby-lang.org/issues/11360. This results in a change in behavior of these methods which is likely undesirable. Fixes #27238
* change `Class#descendants` to public API [ci skip]yuuji.yaginuma2016-09-051-2/+15
| | | | | | `Class#descendants` has already been displayed in Rails guide, so I think that may be displayed in doc. http://guides.rubyonrails.org/active_support_core_extensions.html#descendants
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-2/+2
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-2/+0
| | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* Test if each_object(singleton_class) works, since JRuby added it.Charles Oliver Nutter2015-11-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #22376. JRuby 9.0.5.0 will support ObjectSpace.each_object against a class's singleton class, since that's essentially just walking an internal subclasses structure we already maintain. This test was too narrow, requiring that each_object support an arbitrary class but only actually needing it to work against a class's singleton. This improves performance of Class.descendants by nearly two orders of magnitude when run against JRuby 9.0.5.0: ```ruby 5.times { puts Benchmark.measure { 100_000.times { Numeric.descendants } } } ``` Before: ``` 11.510000 0.140000 11.650000 ( 10.082384) 9.990000 0.020000 10.010000 ( 9.931233) 10.520000 0.040000 10.560000 ( 10.502978) 10.290000 0.030000 10.320000 ( 10.276027) 10.000000 0.030000 10.030000 ( 9.942429) ``` After: ``` 1.380000 0.040000 1.420000 ( 0.365850) 0.210000 0.000000 0.210000 ( 0.149574) 0.180000 0.020000 0.200000 ( 0.141094) 0.140000 0.000000 0.140000 ( 0.140634) 0.190000 0.010000 0.200000 ( 0.147962) ```
* Change Class#subclasses doc exampleDalibor Nasevic2013-02-061-2/+2
|
* Replace comments' non-breaking spaces with spacesclaudiob2012-12-041-1/+1
| | | | | | | | | | 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.
* remove :nodoc: from Class#subclasses [ci skip]Francesco Rodriguez2012-05-281-4/+10
|
* simplify Class#descendants using singleton_class methodSergey Nartimov2012-01-041-1/+1
|
* Class.__subclasses__ was removed from Rubinius.John Firebaugh2011-01-181-34/+20
| | | | | https://github.com/evanphx/rubinius/issues/issue/11 https://github.com/evanphx/rubinius/commit/2fccbb5dad5cb3f5414d635547290538cfc0a2d4
* Define a convention for descendants and subclasses.José Valim2010-07-051-31/+26
| | | | | | The former should be symmetric with ancestors and include all children. However, it should not include self since ancestors + descendants should not have duplicated. The latter is symmetric to superclass in the sense it only includes direct children. By adopting a convention, we expect to have less conflict with other frameworks, as Datamapper. For this moment, to ensure ActiveModel::Validations can be used with Datamapper, we should always call ActiveSupport::DescendantsTracker.descendants(self) internally instead of self.descendants avoiding conflicts.
* Change callbacks to automatically include DescendantsTracker and rename ↵José Valim2010-06-191-5/+5
| | | | descendents to descendants.
* moves Class#reachable? to Module#reachable?, bases implementation on ↵Xavier Noria2010-02-111-6/+3
| | | | anonymous? and constantize, and adds test coverage
* Reinstate Object.subclasses_of and Class#descendents for plugin compat.Jeremy Kemper2010-02-091-0/+58
This reverts commits 7d312e54bad9c39634c137caec07dfc8df471650, 5f981ff0294ba45aa44ad15aa063970b29aeec44, f85f5dfc8ffefff174b695c6363211d342f77a57, 245bfafe335ff883f7a096eab95ac22fe2848679, and ec7c642f5fe60afc857aa64f1a9b4c2be56f9d70