Fixed detection of numbers in ruby