James Edward Gray II wrote:
> raise "Bad integer" unless i_str =~ /\A-?\d+\z/

Depending on your needs (do you want to accept all the strings that ruby 
accepts as integers?), you might want to add _ to that regex (also, 
preceding '+' char):

irb(main):001:0> i_str = "12_345"
=> "12_345"
irb(main):002:0> raise "Bad integer" unless i_str =~ /\A-?\d+\z/
RuntimeError: Bad integer
         from (irb):2
irb(main):003:0> Integer(i_str)
=> 12345

But getting that right is harder than just using Integer().

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407