Travels in Ruby part I


Today on my ruby travels, I realised that .to_i assumes a little too much:

=> 3

As you can see, to_i has made some pretty wild assumptions about what it thinks you wanted, and has selected the first char from the string that is a valid integer.

In the end I used Integer() to ensure that everything was peachy.

Happy coding all!