Interesting question. For me ruby's type of _valid_ format was the reference. At least the 0x 0X is definitively an error on my side. So your code looks quiet fine. Should we allow something like "a632F" to be a valid hexadecimal?

My problem is: ruby is not converting a632F to a number but 0xa632F it will do.
My fear is that we will get the expectation that this "string" is easily convertible to a native ruby number with other methods which can't handle it correct.

I will update the logic with your suggestion!