Can we use http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-Integer for this? This handles parsing correctly and we can properly detect if the value is unparseable.