About extract number from string, there are many Ruby ways as per http://www.ruby-forum.com/topic/125709.

line.scan(/\d/).join('')
line.gsub(/[^0-9]/, '')
line.gsub(/[^\d]/, '')
line.tr("^0-9", '')
line.delete("^0-9")
line.split(/[^\d]/).join
line.gsub(/\D/, '')

Try each on your console.

Also check the benchmark report in that post.

The line.delete("^0-9") is the fastest.

FYI