summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-27 14:46:22 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-27 14:46:22 +0000
commit316f37b18769d5a161df67ebe3edf502d043fc96 (patch)
tree63252898b153163c8c04404ffc036ad458b054f8
parent8231f5f7069fd8098e2567e43dee663eddf6c258 (diff)
merge revision(s) 53667,57735: [Backport #13148]
hash.c: exception examples * hash.c (rb_hash_dig): [DOC] add examples of exceptions. Fix doc for Hash#dig and Struct#dig * hash.c (rb_hash_dig): [DOC] correct argument name in method description; fix formatting in examples. * struct.c (rb_struct_dig): ditto. [ruby-core:79221] [Bug #13148] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--hash.c10
-rw-r--r--struct.c6
-rw-r--r--version.h2
3 files changed, 10 insertions, 8 deletions
diff --git a/hash.c b/hash.c
index 6384dc8167..345d8f7971 100644
--- a/hash.c
+++ b/hash.c
@@ -2699,17 +2699,19 @@ rb_hash_any_p(VALUE hash)
* call-seq:
* hsh.dig(key, ...) -> object
*
- * Extracts the nested value specified by the sequence of <i>idx</i>
+ * Extracts the nested value specified by the sequence of <i>key</i>
* objects by calling +dig+ at each step, returning +nil+ if any
* intermediate step is +nil+.
*
* h = { foo: {bar: {baz: 1}}}
*
- * h.dig(:foo, :bar, :baz) #=> 1
- * h.dig(:foo, :zot, :xyz) #=> nil
+ * h.dig(:foo, :bar, :baz) #=> 1
+ * h.dig(:foo, :zot, :xyz) #=> nil
*
* g = { foo: [10, 11, 12] }
- * g.dig(:foo, 1) #=> 11
+ * g.dig(:foo, 1) #=> 11
+ * g.dig(:foo, 1, 0) #=> TypeError: Fixnum does not have #dig method
+ * g.dig(:foo, :bar) #=> TypeError: no implicit conversion of Symbol into Integer
*/
VALUE
diff --git a/struct.c b/struct.c
index 56b49aa59e..02e32626c2 100644
--- a/struct.c
+++ b/struct.c
@@ -1133,15 +1133,15 @@ rb_struct_size(VALUE s)
* call-seq:
* struct.dig(key, ...) -> object
*
- * Extracts the nested value specified by the sequence of <i>idx</i>
+ * Extracts the nested value specified by the sequence of +key+
* objects by calling +dig+ at each step, returning +nil+ if any
* intermediate step is +nil+.
*
* 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
+ * o.dig(:a, :a, :b, 0) #=> 1
+ * o.dig(:b, 0) #=> nil
*/
static VALUE
diff --git a/version.h b/version.h
index 083438585c..394769aab6 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.3"
#define RUBY_RELEASE_DATE "2017-03-27"
-#define RUBY_PATCHLEVEL 264
+#define RUBY_PATCHLEVEL 265
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 3