From 9471f4187f104f7a0942fdccc884e57cf8027d07 Mon Sep 17 00:00:00 2001 From: marcandre Date: Mon, 23 Dec 2013 03:42:29 +0000 Subject: * array.c: Have to_h raise on elements that are not key-value pairs [#9239] * enum.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'array.c') diff --git a/array.c b/array.c index 0241d72b5f..45713c55b0 100644 --- a/array.c +++ b/array.c @@ -2130,8 +2130,7 @@ rb_ary_to_a(VALUE ary) * ary.to_h -> hash * * Returns the result of interpreting ary as an array of - * [key, value] pairs. Elements other than pairs of - * values are ignored. + * [key, value] pairs. * * [[:foo, :bar], [1, 2]].to_h * # => {:foo => :bar, 1 => 2} @@ -2144,9 +2143,15 @@ rb_ary_to_h(VALUE ary) VALUE hash = rb_hash_new(); for (i=0; i