class RuboCop::Cop::Style::HashConversion

Checks the usage of pre-2.1 ‘Hash` method of converting enumerables and sequences of values to hashes.

Correction code from splat argument (‘Hash`) is not simply determined. For example, `Hash` can be replaced with `ary.each_slice(2).to_h` but it will be complicated. So, `AllowSplatArgument` option is true by default to allow splat argument for simple code.

@safety

This cop's autocorrection is unsafe because `ArgumentError` occurs
if the number of elements is odd:

[source,ruby]
----
Hash[[[1, 2], [3]]] #=> {1=>2, 3=>nil}
[[1, 2], [5]].to_h  #=> wrong array length at 1 (expected 2, was 1) (ArgumentError)
----

@example

# bad
Hash[ary]

# good
ary.to_h

# bad
Hash[key1, value1, key2, value2]

# good
{key1 => value1, key2 => value2}

@example AllowSplatArgument: true (default)

# good
Hash[*ary]

@example AllowSplatArgument: false

# bad
Hash[*ary]