[前][次][番号順一覧][スレッド一覧]

ruby-changes:40526

From: nobu <ko1@a...>
Date: Tue, 17 Nov 2015 11:26:35 +0900 (JST)
Subject: [ruby-changes:40526] nobu:r52607 (trunk): update rdoc of dig methods [ci skip]

nobu	2015-11-17 11:25:28 +0900 (Tue, 17 Nov 2015)

  New Revision: 52607

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52607

  Log:
    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.

  Modified files:
    trunk/ChangeLog
    trunk/array.c
    trunk/hash.c
    trunk/struct.c
Index: array.c
===================================================================
--- array.c	(revision 52606)
+++ array.c	(revision 52607)
@@ -5535,8 +5535,8 @@ rb_ary_any_p(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L5535
  * 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]]]
  *
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52606)
+++ ChangeLog	(revision 52607)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Nov 17 11:25:05 2015  Eric Turner  <ericturnerdev@g...>
+
+	* 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@i...>
 	* NEWS: Small grammatical fix [ci skip]
 
Index: struct.c
===================================================================
--- struct.c	(revision 52606)
+++ struct.c	(revision 52607)
@@ -1126,6 +1126,20 @@ rb_struct_size(VALUE s) https://github.com/ruby/ruby/blob/trunk/struct.c#L1126
     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)
 {
Index: hash.c
===================================================================
--- hash.c	(revision 52606)
+++ hash.c	(revision 52607)
@@ -2695,8 +2695,8 @@ rb_hash_any_p(VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L2695
  * 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}}}
  *

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]