ruby-changes:62735
From: Burdette <ko1@a...>
Date: Fri, 28 Aug 2020 04:54:59 +0900 (JST)
Subject: [ruby-changes:62735] 8095114f17 (master): Comply with guide for method doc: hash.c (#3466)
https://git.ruby-lang.org/ruby.git/commit/?id=8095114f17 From 8095114f1715070fcdc2b29303dcf55a7fcc32a3 Mon Sep 17 00:00:00 2001 From: Burdette Lamar <BurdetteLamar@Y...> Date: Thu, 27 Aug 2020 14:54:36 -0500 Subject: Comply with guide for method doc: hash.c (#3466) Instance methods considered (most unchanged): - any - dig - \<= - \< - \>= - \> - to_proc diff --git a/hash.c b/hash.c index b6f9365..c20ceb3 100644 --- a/hash.c +++ b/hash.c @@ -4515,12 +4515,8 @@ any_p_i_pattern(VALUE key, VALUE value, VALUE arg) https://github.com/ruby/ruby/blob/trunk/hash.c#L4515 * Returns +true+ if any element satisfies a given criterion; * +false+ otherwise. * - * --- - * * With no argument and no block, - * returns +true+ if +self+ is non-empty; +false+ if empty: - * {}.any? # => false - * {nil => false}.any? # => true + * returns +true+ if +self+ is non-empty; +false+ if empty. * * With argument +object+ and no block, * returns +true+ if for any key +key+ @@ -4537,13 +4533,6 @@ any_p_i_pattern(VALUE key, VALUE value, VALUE arg) https://github.com/ruby/ruby/blob/trunk/hash.c#L4533 * h = {foo: 0, bar: 1, baz: 2} * h.any? {|key, value| value < 3 } # => true * h.any? {|key, value| value > 3 } # => false - * - * With argument +object+ and a block, - * issues a warning ('given block not used') and ignores the block: - * h = {foo: 0, bar: 1, baz: 2} - * h.any?([:bar, 1]) # => true - * h.any?([:bar, 0]) # => false - * h.any?([:baz, 1]) # => false */ static VALUE @@ -4584,22 +4573,14 @@ rb_hash_any_p(int argc, VALUE *argv, VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L4573 * The nested objects may be instances of various classes. * See {Dig Methods}[rdoc-ref:doc/dig_methods.rdoc]. * - * Examples: + * Nested Hashes: * h = {foo: {bar: {baz: 2}}} * h.dig(:foo) # => {:bar=>{:baz=>2}} * h.dig(:foo, :bar) # => {:bar=>{:baz=>2}} * h.dig(:foo, :bar, :baz) # => 2 * h.dig(:foo, :bar, :BAZ) # => nil * - * The nested objects may include any that respond to \#dig. See: - * - Hash#dig - * - Array#dig - * - Struct#dig - * - OpenStruct#dig - * - CSV::Table#dig - * - CSV::Row#dig - * - * Example: + * Nested Hashes and Arrays: * h = {foo: {bar: [:a, :b, :c]}} * h.dig(:foo, :bar, 2) # => :c * -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/