for example, hash a
, {:name=>'mike',:age=>27,:gender=>'male'}
and hash b
is {:name=>'mike'}
I am wondering if there is a better way to judge if hash b
is inside hash a
instead of comparing each key one by one?
I found a way to do this, is it more efficient than comparing keys?
a.merge (b) == a
source share