aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--array.c4
-rw-r--r--hash.c4
-rw-r--r--struct.c14
4 files changed, 25 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 78928e8a8e..1d472a4702 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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]
diff --git a/array.c b/array.c
index 7469cc2387..8f8eb1e8d9 100644
--- a/array.c
+++ b/array.c
@@ -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]]]
*
diff --git a/hash.c b/hash.c
index c724b2e2b5..717a548a31 100644
--- a/hash.c
+++ b/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}}}
*
diff --git a/struct.c b/struct.c
index d8c781efa6..cebc445a43 100644
--- a/struct.c
+++ b/struct.c
@@ -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)
{