How use hash except with array values ? Or how create hash line?

arrays, hash, ruby

Solution

What you're doing amounts to calling `H1.except([:state, :code])`.

If the `H1.except(:state, :code)` works, just unsplat the array:

H1.except(*H2.keys)

Problem

Trying to use Hash except with many values from a code H1 = Hash[:state =>1, code => 2] H2 = Hash[:state =>10, code => 20] This work: ``` H1.except(:state, :code) ``` the Hash -> H1 will not contain the values. OK But bellow is not works ``` H1.expect(H2.keys) ``` the Hash -> H1 will contain the values. NOT The problem is because the ruby put the order.keys with BRACKET. I tried to generate from array but also not work

Original source