Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Mention the edge case of any?/all? #7883

Merged
merged 1 commit into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -7768,6 +7768,9 @@ rb_ary_drop_while(VALUE ary)
*
* Returns +true+ if any element of +self+ meets a given criterion.
*
* If +self+ has no element, returns +false+ and argument or block
* are not used.
*
* With no block given and no argument, returns +true+ if +self+ has any truthy element,
* +false+ otherwise:
*
Expand Down Expand Up @@ -7829,6 +7832,9 @@ rb_ary_any_p(int argc, VALUE *argv, VALUE ary)
*
* Returns +true+ if all elements of +self+ meet a given criterion.
*
* If +self+ has no element, returns +true+ and argument or block
* are not used.
*
* With no block given and no argument, returns +true+ if +self+ contains only truthy elements,
* +false+ otherwise:
*
Expand Down
7 changes: 6 additions & 1 deletion enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -1757,6 +1757,9 @@ DEFINE_ENUMFUNCS(all)
*
* Returns whether every element meets a given criterion.
*
* If +self+ has no element, returns +true+ and argument or block
* are not used.
*
* With no argument and no block,
* returns whether every element is truthy:
*
Expand Down Expand Up @@ -1818,6 +1821,9 @@ DEFINE_ENUMFUNCS(any)
*
* Returns whether any element meets a given criterion.
*
* If +self+ has no element, returns +false+ and argument or block
* are not used.
*
* With no argument and no block,
* returns whether any element is truthy:
*
Expand Down Expand Up @@ -1848,7 +1854,6 @@ DEFINE_ENUMFUNCS(any)
* {foo: 0, bar: 1, baz: 2}.any? {|key, value| value < 1 } # => true
* {foo: 0, bar: 1, baz: 2}.any? {|key, value| value < 0 } # => false
*
*
* Related: #all?, #none?, #one?.
*/

Expand Down
5 changes: 5 additions & 0 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -4432,6 +4432,9 @@ any_p_i_pattern(VALUE key, VALUE value, VALUE arg)
* Returns +true+ if any element satisfies a given criterion;
* +false+ otherwise.
*
* If +self+ has no element, returns +false+ and argument or block
* are not used.
*
* With no argument and no block,
* returns +true+ if +self+ is non-empty; +false+ if empty.
*
Expand All @@ -4450,6 +4453,8 @@ any_p_i_pattern(VALUE key, VALUE value, VALUE arg)
* h = {foo: 0, bar: 1, baz: 2}
* h.any? {|key, value| value < 3 } # => true
* h.any? {|key, value| value > 3 } # => false
*
* Related: Enumerable#any?
*/

static VALUE
Expand Down