Ruby

Ruby

Made by DeepSource

Hash merging can be replaced by hash key assignment RB-PR1017

Performance
Major

It is more efficient to replace Hash#merge! with Hash#[]=.

Bad practice

hash.merge!(a: 1)
hash.merge!({'key' => 'value'})

Recommended

hash[:a] = 1
hash['key'] = 'value'