1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

csv.rb: use Array#to_h

* lib/csv.rb (CSV::Row#to_hash): use Array#to_h

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
glass 2017-07-27 06:49:27 +00:00
parent 11f69dccf3
commit 5e3f1a10ca

View file

@ -532,8 +532,7 @@ class CSV
# 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
#