I\'m looking for a better way to do
if hash.key? :a && hash.key? :b && hash.key? :c && hash.key? :d
prefer
You can get a list of missing keys this way:
expected_keys = [:a, :b, :c, :d] missing_keys = expected_keys - hash.keys
If you just want to see if there are any missing keys:
(expected_keys - hash.keys).empty?