From bd19d3d163dc51c70355d5cd65a8db0c2ca33dc8 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sat, 24 Aug 2024 16:31:17 +0100 Subject: [PATCH] [DOC] Tweaks for Array#count doc --- array.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/array.c b/array.c index 3b6920b0a4..a14c532e22 100644 --- a/array.c +++ b/array.c @@ -6344,29 +6344,27 @@ rb_ary_compact(VALUE ary) /* * call-seq: - * array.count -> an_integer - * array.count(obj) -> an_integer - * array.count {|element| ... } -> an_integer + * count -> integer + * count(object) -> integer + * count {|element| ... } -> integer * * Returns a count of specified elements. * * With no argument and no block, returns the count of all elements: * - * [0, 1, 2].count # => 3 - * [].count # => 0 + * [0, :one, 'two', 3, 3.0].count # => 5 * - * With argument +obj+, returns the count of elements == to +obj+: + * With argument +object+ given, returns the count of elements == to +object+: * - * [0, 1, 2, 0.0].count(0) # => 2 - * [0, 1, 2].count(3) # => 0 + * [0, :one, 'two', 3, 3.0].count(3) # => 2 * * With no argument and a block given, calls the block with each element; * returns the count of elements for which the block returns a truthy value: * * [0, 1, 2, 3].count {|element| element > 1} # => 2 * - * With argument +obj+ and a block given, issues a warning, ignores the block, - * and returns the count of elements == to +obj+. + * With argument +object+ and a block given, issues a warning, ignores the block, + * and returns the count of elements == to +object+. */ static VALUE