@@ -2809,16 +2809,19 @@ rb_hash_select(VALUE hash)
2809
2809
* select! {|key, value| ... } -> self or nil
2810
2810
* select! -> new_enumerator
2811
2811
*
2812
- * Returns +self+, whose entries are those for which the block returns a truthy value:
2813
- * h = {foo: 0, bar: 1, baz: 2}
2814
- * h.select! {|key, value| value < 2 } => {foo: 0, bar: 1}
2812
+ * With a block given, calls the block with each entry's key and value;
2813
+ * removes from +self+ each entry for which the block returns +false+ or +nil+.
2815
2814
*
2816
- * Returns +nil + if no entries were removed.
2815
+ * Returns +self + if any entries were removed, +nil+ otherwise:
2817
2816
*
2818
- * Returns a new Enumerator if no block given:
2819
2817
* h = {foo: 0, bar: 1, baz: 2}
2820
- * e = h.select! # => #<Enumerator: {foo: 0, bar: 1, baz: 2}:select!>
2821
- * e.each { |key, value| value < 2 } # => {foo: 0, bar: 1}
2818
+ * h.select! {|key, value| value < 2 } # => {foo: 0, bar: 1}
2819
+ * h.select! {|key, value| value < 2 } # => nil
2820
+ *
2821
+ *
2822
+ * With no block given, returns a new Enumerator.
2823
+ *
2824
+ * Related: see {Methods for Deleting}[rdoc-ref:Hash@Methods+for+Deleting].
2822
2825
*/
2823
2826
2824
2827
static VALUE
0 commit comments