LoginSignup
1
0

More than 5 years have passed since last update.

to_hで配列の配列をハッシュに変換

Last updated at Posted at 2018-07-31
 [["Kanagawa", "yokohama"],["Hokkaido", "sapporo"], ["Okinawa", "naha"]].to_h
=> {"Kanagawa"=>"yokohama", "Hokkaido"=>"sapporo", "Okinawa"=>"naha"}

参考

[Ruby] each_with_objectもmapも使わずにto_hだけで配列をハッシュに変換する

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0