In this case, it would be safe to remove the to_s, since we can count on is_numeric?() to defend against the nil case.  I'll make the change to remove the cast.