I am not so fond of this style as it makes this function depend on how to_f and then to_s is implemented in the particular Ruby being used it is far better to take full charge of what exactly is allowed. Also, since only a boolean is required there is no need to actually create the integer / float. i.e. it is enough to check if it is Numeric, or is a String that matches one of the octal/hex/decimal regular expressions.