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:
parent
11f69dccf3
commit
5e3f1a10ca
1 changed files with 1 additions and 2 deletions
|
@ -532,8 +532,7 @@ class CSV
|
||||||
# order and clobbers duplicate fields.
|
# order and clobbers duplicate fields.
|
||||||
#
|
#
|
||||||
def to_hash
|
def to_hash
|
||||||
# flatten just one level of the internal Array
|
@row.to_h
|
||||||
Hash[*@row.inject(Array.new) { |ary, pair| ary.push(*pair) }]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue