aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
Commit message (Collapse)AuthorAgeFilesLines
* Change wording of some instances of 'opt out' [ci skip]Sharang Dashputre2019-03-121-5/+5
|
* Consistently use kwargs for `instance_{reader,writer,accessor}` optionsRyuta Kamizono2018-10-201-12/+7
| | | | | | | | Since #29294, `mattr_acessor` uses kwargs for `instance_reader`, `instance_writer`, and `instance_accessor` options. `thread_mattr_accessor` and `config_accessor` also take the same options, so let's maintain these options handles the same.
* Fix example in thread_mattr_accessor documentationFabian Mersch2018-07-311-1/+1
|
* Remove unused `require "active_support/core_ext/regexp"`Ryuta Kamizono2018-07-291-1/+0
| | | | | | | | Ruby 2.4 has native `Regexp#match?`. https://ruby-doc.org/core-2.4.0/Regexp.html#method-i-match-3F Related #32034.
* [Active Support] require_relative => requireAkira Matsuda2017-10-211-2/+2
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* [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
|
* doc, hide non-public methods form the api docs. [ci skip]Yves Senn2016-10-201-2/+2
| | | | | | | | | This is a follow up to #25681, specifically this comment: https://github.com/rails/rails/pull/25681#issuecomment-238294002 The way the thread local variable is stored is an implementation detail and subject to change. It makes no sense to only generate a reader or writer as you'd have to know where to read from or where it writes to.
* Merge pull request #25570 from y-yagi/remove_useless_parameterEileen M. Uchitelle2016-08-151-3/+3
|\ | | | | remove useless parameter
| * remove useless parameteryuuji.yaginuma2016-06-291-4/+4
| |
* | let instance thread_mattr_* methods delegate to the class-level onesXavier Noria2016-08-081-4/+10
| | | | | | | | | | | | | | This code has too much duplication and the rationale for the concatenation may not be obvious to the reader. You define the ones at class-level, explain why does the code concatenates there, and then the convenience ones at instance-level just delegate.
* | Merge pull request #25681 from willnet/fix-thread_mattr_accessorYves Senn2016-08-081-4/+4
|\ \ | | | | | | | | | Fix `thread_mattr_accessor` share variable superclass with subclass
| * | Fix `thread_mattr_accessor` share variable superclass with subclasswillnet2016-08-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of `thread_mattr_accessor` set variable sharing superclass with subclass. So the method doesn't work as documented. Precondition class Account thread_mattr_accessor :user end class Customer < Account end Account.user = "DHH" Account.user #=> "DHH" Customer.user = "Rafael" Customer.user # => "Rafael" Documented behavior Account.user # => "DHH" Actual behavior Account.user # => "Rafael" Current implementation set variable statically likes `Thread[:attr_Account_user]`, and customer also use it. Make variable name dynamic to use own thread-local variable.
* | | 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.
* / systematic revision of =~ usage in ASXavier Noria2016-07-221-3/+4
|/ | | | | Where appropriate prefer the more concise Regexp#match?, String#include?, String#start_with?, and String#end_with?
* [skip ci] Fix grammarAbhishek Jain2016-06-031-2/+2
|
* Fix `thread_mattr_accessor` thread-local variable namingMichael Ryan2016-03-111-2/+2
| | | | | | | | | | | | | | | | | The current implentation of `thread_mattr_accessor` is setting differently-named thread variables when defining class and instance writer methods, so the method isn't working as documented: Account.user = "DHH" Account.user # => "DHH" Account.new.user # => nil a = Account.new a.user = "ABC" # => "ABC" a.class.user # => "DHH" At this point `:attr_Account_user` and `:attr_Class_user` thread-local variables have been created. Modify the reader and writer methods to use the class name instead of 'Class'.
* [ci skip] Revert most of ff851017Kasper Timm Hansen2015-12-181-2/+2
| | | We went back to `Thread.current[]` in 33e11e59.
* Revert "Use Thread.current.thread_variable_set/get insetad of the direct ↵David Heinemeier Hansson2015-12-181-4/+4
| | | | | | accessors" This reverts commit 301f43820562c6a70dffe30f4227ff0751f47d4f per @matthewd on https://github.com/rails/rails/pull/22630/files#r47997074
* [ci skip] Add `Thread.current` to match internalsKasper Timm Hansen2015-12-171-2/+2
| | | | | | | | We call the thread variable accessors on `Thread.current`, which matches Ruby's documentation: http://ruby-doc.org/core-2.2.0/Thread.html#method-i-thread_variable_get Fix these to stay `current` ( ͡° ͜ʖ ͡°)
* Clarify thread_mattr_accessor subclass behavior documentationNate Berkopec2015-12-171-8/+9
| | | | [ci skip]
* Copy-edit the Per Thread attribute accessor documentationRafael Mendonça França2015-12-171-3/+3
| | | | [ci skip]
* Use Thread.current.thread_variable_set/get insetad of the direct accessorsDavid Heinemeier Hansson2015-12-171-4/+4
|
* Fix typo in thread_mattr_accessor doco [ci skip]Nate Berkopec2015-12-171-1/+1
|
* Add thread_m/cattr_accessor/reader/writer suite of methods for declaring ↵David Heinemeier Hansson2015-12-171-0/+140
class and module variables that live per-thread