-A white key peg indicates the existence of a correct colour code peg placed in the wrong position
I found my answer. The white peg code control should be
elsif code.include?(guess[index]) && code[index] != guess[index]
CLICK HERE to find out more related problems solutions.