Hash Inclusion
A hash is set-like in that it cannot have duplicate entries (or even duplicate keys). Hash inclusion can therefore based on the idea of subset and superset.
Two hashes may be tested for inclusion, based on comparisons of their entries.
An entry h0[k0] in one hash is equal to an entry h1[k1] in another hash if and only if the two keys are equal (k0 == k1) and their two values are equal (h0[k0] == h1[h1]).
A hash may be a subset or a superset of another hash:
-
Subset (included in or equal to another):
-
Hash
h0is a subset of hashh1(see Hash#<=) if each entry inh0is equal to an entry inh1. -
Further,
h0is a proper subset ofh1(see Hash#<) ifh1is larger thanh0.
-
-
Superset (including or equal to another):
-
Hash
h0is a superset of hashh1(see Hash#>=) if each entry inh1is equal to an entry inh0. -
Further,
h0is a proper superset ofh1(see Hash#>) ifh0is larger thanh1.
-