diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-12-21 09:47:04 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-12-21 09:47:04 +0100 |
commit | 9c9c54abe08d86967efd3dcac1d65158a0ff74ea (patch) | |
tree | 0477635ee0e53b6e76794a29df9ed03ef979a2b1 /activesupport/lib | |
parent | 85a8175cb0a5f25425be4dfede2c12c3f6685e7d (diff) | |
parent | b864d887501d249b085db7ec686f4e266d301b8a (diff) | |
download | rails-9c9c54abe08d86967efd3dcac1d65158a0ff74ea.tar.gz rails-9c9c54abe08d86967efd3dcac1d65158a0ff74ea.tar.bz2 rails-9c9c54abe08d86967efd3dcac1d65158a0ff74ea.zip |
Merge pull request #22706 from habermann24/fix_mattr_accessor_docs
Fix documentation for mattr_accessor methods [ci skip]
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/attribute_accessors.rb | 12 |
1 files changed, 6 insertions, 6 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 124f90dc0f..76825862d7 100644 --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb @@ -49,7 +49,7 @@ class Module # include HairColors # end # - # Person.hair_colors # => [:brown, :black, :blonde, :red] + # Person.new.hair_colors # => [:brown, :black, :blonde, :red] def mattr_reader(*syms) options = syms.extract_options! syms.each do |sym| @@ -105,7 +105,7 @@ class Module # # Also, you can pass a block to set up the attribute with a default value. # - # class HairColors + # module HairColors # mattr_writer :hair_colors do # [:brown, :black, :blonde, :red] # end @@ -150,8 +150,8 @@ class Module # include HairColors # end # - # Person.hair_colors = [:brown, :black, :blonde, :red] - # Person.hair_colors # => [:brown, :black, :blonde, :red] + # HairColors.hair_colors = [:brown, :black, :blonde, :red] + # HairColors.hair_colors # => [:brown, :black, :blonde, :red] # Person.new.hair_colors # => [:brown, :black, :blonde, :red] # # If a subclass changes the value then that would also change the value for @@ -161,8 +161,8 @@ class Module # class Male < Person # end # - # Male.hair_colors << :blue - # Person.hair_colors # => [:brown, :black, :blonde, :red, :blue] + # Male.new.hair_colors << :blue + # Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue] # # To opt out of the instance writer method, pass <tt>instance_writer: false</tt>. # To opt out of the instance reader method, pass <tt>instance_reader: false</tt>. |