Using to_sym rather than .intern for comparison of symbols rather than strings. Also try not allow assignment of strings to @elementHash[:elementtype] only symbols.