aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/class/attribute.rb
Commit message (Collapse)AuthorAgeFilesLines
* activesupport: Simplify class_attribute implementation (#35454)Dylan Thacker-Smith2019-03-031-15/+10
| | | | | | | | * activesupport(class_attribute): Use redefine_singleton_method * activesupport(class_attribute): Use keyword arguments * activesupport(class_attribute): Avoid unnecessary redefinition for default
* PERF: symbolize ivar, to reduce dupesSam2018-02-151-1/+1
| | | | | | | | | | | | I noticed this in my memory profiler report. ``` 153 "@default_url_options" 152 /home/sam/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.1.4/lib/active_support/core_ext/class/attribute.rb:84 ``` 152 copies of the string `@default_url_options` are retained on the heap in Discourse post boot. Since this is just used for ivar lookups there is no need to use a string.
* [Active Support] require_relative => requireAkira Matsuda2017-10-211-3/+3
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* Clarify intentions around method redefinitionsMatthew Draper2017-09-011-14/+11
| | | | | | | | | Don't use remove_method or remove_possible_method just before a new definition: at best the purpose is unclear, and at worst it creates a race condition. Instead, prefer redefine_method when practical, and silence_redefinition_of_method otherwise.
* Merge pull request #29758 from glaucocustodio/patch-1 [ci skip]Sean Griffin2017-07-171-0/+10
|\ | | | | Add documentation for class_attribute default option
| * Add documentation for class_attribute optionsGlauco Custódio2017-07-171-0/+10
| |
* | [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-3/+3
|
* Add option for class_attribute default (#29270)David Heinemeier Hansson2017-05-291-2/+11
| | | | | | | | | | | | * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation
* [ci skip] Remove not necessary whitespaceAndrey Molchanov2016-09-281-1/+1
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-3/+3
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Update class_attribute docsJohn Gesimondo2016-07-101-1/+1
|
* Add Module#remove_possible_singleton_methodAndrew White2015-10-211-1/+10
| | | | | This is primarily to fix method redefinition warnings in class_attribute but may be of use in other places where we define singleton methods.
* singleton_class? is already pressent at Ruby 2.2Rafael Mendonça França2015-01-041-8/+0
|
* Fix `singleton_class?`Vipul A M2013-10-151-2/+5
| | | | | Due to changes from http://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39628 current `singleton_class?` implementation fails. Changed based on reference from http://bugs.ruby-lang.org/issues/7609
* Remove a comment related to 920753fRobin Dupret2013-06-261-1/+0
| | | Since 920753f, double assignment isn't used anymore
* this variable is used, so we don't have to use double assignmentsAaron Patterson2013-05-151-1/+1
|
* Add option to Class#class_attribute for skipping the query methodAgis-2013-04-061-3/+5
|
* removing out of date comment. ↵Aaron Patterson2013-03-121-3/+0
| | | | :heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart: @pixeltrix
* drop memory consumption and startup speed by switching to define_methodAaron Patterson2013-03-121-23/+28
|
* Remove 'assigned but unused variable' warningArun Agrawal2012-12-281-1/+2
|
* Add comment about implementation of class_attributeAndrew White2012-12-061-0/+3
| | | | | | | To prevent future pull requests like #8435 add a comment about the implementation of class_attribute using class_eval for performance. [ci skip]
* update AS/core_ext docs [ci skip]Francesco Rodriguez2012-09-121-3/+3
|
* Revert "DRY class_attribute code"José Valim2012-07-301-3/+6
| | | | | | | class_attribute is a building block and using define_method can be much slower for such basic method definitions. This reverts commit d59208d7032e2be855a89ad8d4685cc08dd7cdb3.
* DRY class_attribute codeAleksandr Zykov2012-07-291-6/+3
|
* Add instance_accessor option to class_attributeAlexey Vakhov2012-05-221-2/+4
|
* Indentation for private methodsAlexey Gaziev2012-04-291-3/+3
| | | | https://github.com/rails/rails/commit/e7d55f734aae204115d0a04a2db774ac364c1312
* use correct variant of checking whether class is a singletonSergey Nartimov2012-01-031-1/+1
|
* Revert "Merge pull request #4220 from bensie/singleton-class-master"Jon Leighton2011-12-281-1/+14
| | | | | | | This reverts commit 90df0d4f687596943bda108ab0b98dd99cacd46b, reversing changes made to 5e6fc81d63837559a393c173eade281ddeb687dd. Reason: build breakage
* Further simplify singleton_class checking in class_attributeJames Miller2011-12-281-14/+1
|
* simplify singleton_class? methodAaron Patterson2011-07-231-7/+1
|
* Ugh, the class_attribute pull request broke the build. fix it.José Valim2011-06-191-7/+4
|
* Add option to omit creating an instance reader method on class_attributeJames Miller2011-06-181-7/+20
|
* Use #remove_possible_method insteadSebastian Martinez2011-05-041-1/+1
|
* Merge remote branch 'miloops/warnings'José Valim2010-09-271-0/+1
|\ | | | | | | | | Conflicts: actionpack/lib/action_controller/metal/url_for.rb
| * Remove method if already exists to avoid warnings.Emilio Tagua2010-09-271-0/+1
| |
* | Creating singleton class for every object whenever the instance-level ↵thedarkone2010-09-271-1/+21
|/ | | | accessor is used quite is expensive.
* Class Attribute setter returns set valuePeter Wagenet2010-08-161-0/+1
| | | | Signed-off-by: wycats <wycats@gmail.com>
* applied guidelines to "# =>"Paco Guzman2010-08-121-6/+6
|
* More documentation to class_attribute.José Valim2010-07-281-11/+24
|
* clarifying the instance_write option with an exampleNeeraj Singh2010-07-281-1/+5
|
* updating description of how class_attribute worksNeeraj Singh2010-07-281-0/+5
|
* clarifying description for class_attribute methodNeeraj Singh2010-07-271-2/+2
|
* refactor evals and adds some __FILE__ and __LINE__Santiago Pastorino2010-05-201-4/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Not using class_eval wasn't adding clarity herewycats2010-04-101-15/+24
|
* moves Object#singleton_class to Kernel#singleton_class to match Ruby also ↵Xavier Noria2010-04-051-1/+1
| | | | there, same for #class_eval to simplify, and adds coverage for class_eval
* Fix class_attribute so that it works with singleton classes.Carl Lerche2010-04-011-1/+1
|
* Remove some 1.9 warnings (resulting in some fixed bugs). Remaining AM ↵wycats2010-03-171-0/+3
| | | | warnings are in dependencies.
* class_attribute gets instance methods which delegate to but may override ↵Jeremy Kemper2010-03-081-2/+23
| | | | their class values as you'd expect. Disable instance writer methods with :instance_writer => false.