diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-01-04 23:39:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-04 23:39:11 -0500 |
commit | d66789fa0e3ac589f06feb735a3451fb4d9405fc (patch) | |
tree | c34cfbdcd25e918e0329631fd9f57268eae370dc | |
parent | 333283e79dc45c294f6928adf6dc2f0a7a7dedde (diff) | |
parent | 9e5741ca751f2da62b32dbc712429c49a4f7fabf (diff) | |
download | rails-d66789fa0e3ac589f06feb735a3451fb4d9405fc.tar.gz rails-d66789fa0e3ac589f06feb735a3451fb4d9405fc.tar.bz2 rails-d66789fa0e3ac589f06feb735a3451fb4d9405fc.zip |
Merge pull request #26480 from tbrisker/fix-26461
Clarify that mattr_* creates public methods
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/attribute_accessors.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb index 90989f4f3d..2c24081eb9 100644 --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb @@ -7,7 +7,8 @@ require "active_support/core_ext/regexp" class Module # Defines a class attribute and creates a class and instance reader methods. # The underlying class variable is set to +nil+, if it is not previously - # defined. + # defined. All class and instance methods created will be public, even if + # this method is called with a private or protected access modifier. # # module HairColors # mattr_reader :hair_colors @@ -76,7 +77,9 @@ class Module alias :cattr_reader :mattr_reader # Defines a class attribute and creates a class and instance writer methods to - # allow assignment to the attribute. + # allow assignment to the attribute. All class and instance methods created + # will be public, even if this method is called with a private or protected + # access modifier. # # module HairColors # mattr_writer :hair_colors @@ -142,6 +145,8 @@ class Module alias :cattr_writer :mattr_writer # Defines both class and instance accessors for class attributes. + # All class and instance methods created will be public, even if + # this method is called with a private or protected access modifier. # # module HairColors # mattr_accessor :hair_colors |