ruby-changes:47312
From: glass <ko1@a...>
Date: Thu, 27 Jul 2017 15:49:33 +0900 (JST)
Subject: [ruby-changes:47312] glass:r59426 (trunk): csv.rb: use Array#to_h
glass 2017-07-27 15:49:27 +0900 (Thu, 27 Jul 2017) New Revision: 59426 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59426 Log: csv.rb: use Array#to_h * lib/csv.rb (CSV::Row#to_hash): use Array#to_h Modified files: trunk/lib/csv.rb Index: lib/csv.rb =================================================================== --- lib/csv.rb (revision 59425) +++ lib/csv.rb (revision 59426) @@ -532,8 +532,7 @@ class CSV https://github.com/ruby/ruby/blob/trunk/lib/csv.rb#L532 # order and clobbers duplicate fields. # def to_hash - # flatten just one level of the internal Array - Hash[*@row.inject(Array.new) { |ary, pair| ary.push(*pair) }] + @row.to_h end # -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/