Check if a hash's keys include all of a set of keys
%i[a b c d].all? {|s| hash.key? s}
@Mori's way is best, but here's another way:
([:a, :b, :c, :d] - hash.keys).empty?
or
hash.slice(:a, :b, :c, :d).size == 4
%i[a b c d].all? {|s| hash.key? s}
@Mori's way is best, but here's another way:
([:a, :b, :c, :d] - hash.keys).empty?
or
hash.slice(:a, :b, :c, :d).size == 4