Inspectopedia
 
2024.3

Incorrect 'Hash[...]' call

Warning
New
Last modified: 03 December 2024

Reports improperly constructed Hash[...] calls. There are 3 correct ways to construct a new hash using [...]:

  • Hash['a', 100, 'b', 200]

  • Hash[ [ ['a', 100], ['b', 200] ] ]

  • Hash['a' => 100, 'b' => 200]

Inspired by 'Ruby Style Guide'