how to convert string into int

~/Desktop: irb
irb(main):005:0> "1 2 3 4 5".scan(/\d+/).inject(0) { |sum,item| sum+item.to_i }
=> 15