Say, we have a Hash with codes for colors: COLOR = { :red => 1, :white => 2, :black => 3, :yellow => 4 } …and we want to check which color belongs to number 3. COLOR.invert[3] #=> :black This tip uses Hash#invert, which “returns a new hash, created by using hsh‘s values as keys, and the keys as values.”