Ignore constants by name and not values.

Due to certain constants referring to the same value (but using a different
name) the old method would ignore these constants. A good example of this is
Encoding::BINARY which is the same as Encoding::ASCII_8BIT.

Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>