update rdoc of dig methods [ci skip]

* array.c (rb_ary_dig), hash.c (rb_hash_dig): [DOC] Update
  comments describing dig methods.  [Fix GH-1103]
* struct.c (rb_struct_dig): [DOC] add rdoc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-11-17 02:25:28 +00:00
Родитель 8e465f9c99
Коммит 0701e5ff46
4 изменённых файлов: 25 добавлений и 4 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Tue Nov 17 11:25:05 2015 Eric Turner <ericturnerdev@gmail.com>
* array.c (rb_ary_dig), hash.c (rb_hash_dig): [DOC] Update
comments describing dig methods. [Fix GH-1103]
* struct.c (rb_struct_dig): [DOC] add rdoc.
Tue Nov 17 11:22:22 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
* NEWS: Small grammatical fix [ci skip]

Просмотреть файл

@ -5535,8 +5535,8 @@ rb_ary_any_p(VALUE ary)
* call-seq:
* ary.dig(idx, ...) -> object
*
* Retrieves the value object corresponding to the each <i>idx</i>
* objects repeatedly.
* Extracts the nested array value specified by the sequence of <i>idx</i>
* objects.
*
* a = [[1, [2, 3]]]
*

4
hash.c
Просмотреть файл

@ -2695,8 +2695,8 @@ rb_hash_any_p(VALUE hash)
* call-seq:
* hsh.dig(key, ...) -> object
*
* Retrieves the value object corresponding to the each <i>key</i>
* objects repeatedly.
* Extracts the nested hash value specified by the sequence of <i>key</i>
* objects.
*
* h = { foo: {bar: {baz: 1}}}
*

Просмотреть файл

@ -1126,6 +1126,20 @@ rb_struct_size(VALUE s)
return LONG2FIX(RSTRUCT_LEN(s));
}
/*
* call-seq:
* struct.dig(key, ...) -> object
*
* Extracts the nested struct value specified by the sequence of <i>key</i>
* objects.
*
* klass = Struct.new(:a)
* o = klass.new(klass.new({b: [1, 2, 3]}))
*
* o.dig(:a, :a, :b, 0) #=> 1
* o.dig(:b, 0) #=> nil
*/
static VALUE
rb_struct_dig(int argc, VALUE *argv, VALUE self)
{