Hash#values_at

hash = { key1: "value1", key2: "value2", key3: "value3" }
values = hash.values_at(:key1, :key2)
p values #=> ["value1", "value2"]

Hash#values_at (Ruby 3.2 リファレンスマニュアル)

in を使う

hash = { key1: "value1", key2: "value2", key3: "value3" }
hash in {key1:, key3:}
puts key1, key3 # value1, value3

=> (右代入)

hash = { key1: "value1", key2: "value2", key3: "value3" }
hash => {key1:, key3:}
puts key1, key3 # value1, value3

変数名を変えることも可能。

hash = { key1: "value1", key2: "value2", key3: "value3" }
hash => {key1: x, key3: y}
puts x, y # value1, value3

参考. Ruby3の1行パターンマッチ(右代入)と一行メソッド定義(エンドレスメソッド)について - Qiita