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

ruby-changes:41593

From: nobu <ko1@a...>
Date: Wed, 27 Jan 2016 16:29:48 +0900 (JST)
Subject: [ruby-changes:41593] nobu:r53667 (trunk): hash.c: exception examples

nobu	2016-01-27 16:30:42 +0900 (Wed, 27 Jan 2016)

  New Revision: 53667

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

  Log:
    hash.c: exception examples
    
    * hash.c (rb_hash_dig): [DOC] add examples of exceptions.

  Modified files:
    trunk/hash.c
Index: hash.c
===================================================================
--- hash.c	(revision 53666)
+++ hash.c	(revision 53667)
@@ -2702,6 +2702,8 @@ rb_hash_any_p(VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L2702
  *
  *   g = { foo: [10, 11, 12] }
  *   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

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

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