That expression evaluates to
true
if the char is not a digit.
x =~ /\d/
runs the
regular expression[
^]
\d
on the char: if there is a digit in the string (which is, in this case, only 1 char), this expression returns the index of the digit. If it does not contain a digit, it returns
nil
.
.nil?
checks whether
x =~ /\d/
equals
nil
. If it does, it returns true. If it does not, it returns false.