diff options
author | Radosław Bułat <[email protected]> | 2020-12-18 17:40:31 +0100 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2020-12-19 09:22:26 +0900 |
commit | d40d95296d0947edf513ad5bc7d4bf338b2e3877 (patch) | |
tree | a6973cc038f7575147474a04ebf6158ec889ecd1 | |
parent | 76e88480371469400346fca609efe67096813915 (diff) |
Feature 17314: update docs and NEWS about attr* methods returning array of symbols
-rw-r--r-- | NEWS.md | 5 | ||||
-rw-r--r-- | object.c | 24 |
2 files changed, 17 insertions, 12 deletions
@@ -249,6 +249,10 @@ Outstanding ones only. p C.ancestors #=> [C, M1, M2, Object, Kernel, BasicObject] ``` + * Module#attr_accessor, Module#attr_reader, Module#attr_writer and Module#attr + methods now return array of defined methods names as symbols. + [[Feature #17314]] + * Mutex * `Mutex` is now acquired per-`Fiber` instead of per-`Thread`. This change @@ -704,3 +708,4 @@ end [Feature #17351]: https://bugs.ruby-lang.org/issues/17351 [Feature #17371]: https://bugs.ruby-lang.org/issues/17371 [GH-2991]: https://github.com/ruby/ruby/pull/2991 +[Feature #17314]: https://bugs.ruby-lang.org/issues/17314 @@ -2255,10 +2255,10 @@ id_for_attr(VALUE obj, VALUE name) /* * call-seq: - * attr_reader(symbol, ...) -> nil - * attr(symbol, ...) -> nil - * attr_reader(string, ...) -> nil - * attr(string, ...) -> nil + * attr_reader(symbol, ...) -> array + * attr(symbol, ...) -> array + * attr_reader(string, ...) -> array + * attr(string, ...) -> array * * Creates instance variables and corresponding methods that return the * value of each instance variable. Equivalent to calling @@ -2283,9 +2283,9 @@ rb_mod_attr_reader(int argc, VALUE *argv, VALUE klass) /** * call-seq: - * attr(name, ...) -> nil - * attr(name, true) -> nil - * attr(name, false) -> nil + * attr(name, ...) -> array + * attr(name, true) -> array + * attr(name, false) -> array * * The first form is equivalent to #attr_reader. * The second form is equivalent to <code>attr_accessor(name)</code> but deprecated. @@ -2314,8 +2314,8 @@ rb_mod_attr(int argc, VALUE *argv, VALUE klass) /* * call-seq: - * attr_writer(symbol, ...) -> nil - * attr_writer(string, ...) -> nil + * attr_writer(symbol, ...) -> array + * attr_writer(string, ...) -> array * * Creates an accessor method to allow assignment to the attribute * <i>symbol</i><code>.id2name</code>. @@ -2339,8 +2339,8 @@ rb_mod_attr_writer(int argc, VALUE *argv, VALUE klass) /* * call-seq: - * attr_accessor(symbol, ...) -> nil - * attr_accessor(string, ...) -> nil + * attr_accessor(symbol, ...) -> array + * attr_accessor(string, ...) -> array * * Defines a named attribute for this module, where the name is * <i>symbol.</i><code>id2name</code>, creating an instance variable @@ -2350,7 +2350,7 @@ rb_mod_attr_writer(int argc, VALUE *argv, VALUE klass) * Returns an array of defined methods names as symbols. * * module Mod - * attr_accessor(:one, :two) + * attr_accessor(:one, :two) #=> [:one, :one=, :two, :two=] * end * Mod.instance_methods.sort #=> [:one, :one=, :two, :two=] */ |